MCPcopy
hub / github.com/spf13/pflag / AddFlagSet

Method AddFlagSet

flag.go:911–920  ·  view source on GitHub ↗

AddFlagSet adds one FlagSet to another. If a flag is already present in f the flag from newSet will be ignored.

(newSet *FlagSet)

Source from the content-addressed store, hash-verified

909// AddFlagSet adds one FlagSet to another. If a flag is already present in f
910// the flag from newSet will be ignored.
911func (f *FlagSet) AddFlagSet(newSet *FlagSet) {
912 if newSet == nil {
913 return
914 }
915 newSet.VisitAll(func(flag *Flag) {
916 if f.Lookup(flag.Name) == nil {
917 f.AddFlag(flag)
918 }
919 })
920}
921
922// Var defines a flag with the specified name and usage string. The type and
923// value of the flag are represented by the first argument, of type Value, which

Callers 2

TestAddFlagSetFunction · 0.95

Calls 3

LookupMethod · 0.95
AddFlagMethod · 0.95
VisitAllMethod · 0.80

Tested by 2

TestAddFlagSetFunction · 0.76