Skip to content
Myr

Use AddFlagSet instead of self-written function

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Albert Nigmatzianov · committed by Albert Nigmatzianov · parent 458d797 · Browse files · 1 file+1 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−7 removed

  • other:+1 added−7 removed

1 file+1 added−7 removed

modified:command.go+1 added-7 removed
1226 unmodified lines
12271228// mergePersistentFlags merges c.PersistentFlags() to c.Flags()1229// and adds missing persistent flags of all parents.1230func (c *Command) mergePersistentFlags() {1231 if c.HasPersistentFlags() {1232 c.PersistentFlags().VisitAll(func(f *flag.Flag) {1233 if c.Flags().Lookup(f.Name) == nil {1234 c.Flags().AddFlag(f)1235 }1236 })1237 }1231 c.Flags().AddFlagSet(c.PersistentFlags())12321233 added := c.updateParentsPflags()1234 if len(added) > 0 {1235 for _, f := range added {
34 unmodified lines