mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
simplify mark flags
This commit is contained in:
parent
b19c5d4ab1
commit
0967a36905
1 changed files with 1 additions and 1 deletions
|
@ -58,7 +58,7 @@ func MarkFlagRequired(flags *pflag.FlagSet, name string) error {
|
|||
// and causes your command to report an error if invoked without any of the flags.
|
||||
func MarkFlagsRequired(flags *pflag.FlagSet, names ...string) error {
|
||||
for _, name := range names {
|
||||
if err := flags.SetAnnotation(name, BashCompOneRequiredFlag, []string{"true"}); err != nil {
|
||||
if err := MarkFlagRequired(flags, name); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue