Skip to content

Commit

Permalink
Fix check for mutual exclusion flags (#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
Integralist authored Oct 26, 2022
1 parent 659296e commit e688f98
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,13 @@ func IsHelpFlagOnly(args []string) bool {
// IsVerboseAndQuiet indicates if the user called `fastly --verbose --quiet`.
// These flags are mutually exclusive.
func IsVerboseAndQuiet(args []string) bool {
matches := []bool{}
matches := map[string]bool{}
for _, a := range args {
if a == "--verbose" || a == "-v" || a == "--quiet" || a == "-q" {
matches = append(matches, true)
if a == "--verbose" || a == "-v" {
matches["--verbose"] = true
}
if a == "--quiet" || a == "-q" {
matches["--quiet"] = true
}
}
return len(matches) > 1
Expand Down

0 comments on commit e688f98

Please sign in to comment.