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

Method AddGoFlagSet

golangflag.go:104–115  ·  view source on GitHub ↗

AddGoFlagSet will add the given *flag.FlagSet to the pflag.FlagSet

(newSet *goflag.FlagSet)

Source from the content-addressed store, hash-verified

102
103// AddGoFlagSet will add the given *flag.FlagSet to the pflag.FlagSet
104func (f *FlagSet) AddGoFlagSet(newSet *goflag.FlagSet) {
105 if newSet == nil {
106 return
107 }
108 newSet.VisitAll(func(goflag *goflag.Flag) {
109 f.AddGoFlag(goflag)
110 })
111 if f.addedGoFlagSets == nil {
112 f.addedGoFlagSets = make([]*goflag.FlagSet, 0)
113 }
114 f.addedGoFlagSets = append(f.addedGoFlagSets, newSet)
115}
116
117// CopyToGoFlagSet will add all current flags to the given Go flag set.
118// Deprecation remarks get copied into the usage description.

Callers 1

TestGoflagsFunction · 0.95

Calls 2

AddGoFlagMethod · 0.95
VisitAllMethod · 0.80

Tested by 1

TestGoflagsFunction · 0.76