We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 196caa9 commit 26fe3beCopy full SHA for 26fe3be
internal/cli/arguments/arguments.go
@@ -25,12 +25,16 @@ import (
25
26
// CheckFlagsConflicts is a helper function useful to report errors when more than one conflicting flag is used
27
func CheckFlagsConflicts(command *cobra.Command, flagNames ...string) {
28
+ var used []string
29
for _, flagName := range flagNames {
- if !command.Flag(flagName).Changed {
30
- return
+ if command.Flag(flagName).Changed {
31
+ used = append(used, flagName)
32
}
33
- flags := "--" + strings.Join(flagNames, ", --")
34
+ if len(used) <= 1 {
35
+ return
36
+ }
37
+ flags := "--" + strings.Join(used, ", --")
38
msg := i18n.Tr("Can't use the following flags together: %s", flags)
39
feedback.Fatal(msg, feedback.ErrBadArgument)
40
0 commit comments