0
0
forked from toolshed/abra

fix: handle flags order validatio better

Closes coop-cloud/organising#214.
This commit is contained in:
2021-11-02 14:08:54 +01:00
parent 3b77607f36
commit 0486091768
2 changed files with 20 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package internal
import (
"errors"
"strings"
"coopcloud.tech/abra/pkg/app"
"coopcloud.tech/abra/pkg/catalogue"
@ -111,3 +112,17 @@ func ValidateDomain(c *cli.Context) (string, error) {
return domainName, nil
}
// ValidateSubCmdFlags ensures flag order conforms to correct order
func ValidateSubCmdFlags(c *cli.Context) bool {
for argIdx, arg := range c.Args().Slice() {
if !strings.HasPrefix(arg, "--") {
for _, flag := range c.Args().Slice()[argIdx:] {
if strings.HasPrefix(flag, "--") {
return false
}
}
}
}
return true
}