simplify mark flags

This commit is contained in:
Sean Pino 2024-02-20 10:54:19 -05:00
parent b19c5d4ab1
commit 0967a36905

View file

@ -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. // and causes your command to report an error if invoked without any of the flags.
func MarkFlagsRequired(flags *pflag.FlagSet, names ...string) error { func MarkFlagsRequired(flags *pflag.FlagSet, names ...string) error {
for _, name := range names { for _, name := range names {
if err := flags.SetAnnotation(name, BashCompOneRequiredFlag, []string{"true"}); err != nil { if err := MarkFlagRequired(flags, name); err != nil {
return err return err
} }
} }