File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,17 @@ func FlagUsages(f *pflag.FlagSet) string {
73
73
}
74
74
}
75
75
76
- line += "\n - " + usage
76
+ if len (flag .Annotations ["cobra_annotation_mutually_exclusive" ]) != 0 {
77
+ mutuale := fmt .Sprintf ("%v" , flag .Annotations ["cobra_annotation_mutually_exclusive" ])
78
+ mutuale = strings .ReplaceAll (mutuale , "]" , "" )
79
+ mutuale = strings .ReplaceAll (mutuale , "[" , "" )
80
+ mutuale = strings .ReplaceAll (mutuale , flag .Name + " " , "" )
81
+ mutuale = strings .ReplaceAll (mutuale , " " + flag .Name , "" )
82
+ mutuale = strings .ReplaceAll (mutuale , " " , ", --" )
83
+ line += "\n - " + usage + "\n \n Mutually exclusive with --" + mutuale + "."
84
+ } else {
85
+ line += "\n - " + usage
86
+ }
77
87
if ! defaultIsZeroValue (flag ) {
78
88
if flag .Value .Type () == stringType {
79
89
line += fmt .Sprintf (" This value defaults to %q." , flag .DefValue )
You can’t perform that action at this time.
0 commit comments