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

Method GetStringToInt

string_to_int.go:91–97  ·  view source on GitHub ↗

GetStringToInt return the map[string]int value of a flag with the given name

(name string)

Source from the content-addressed store, hash-verified

89
90// GetStringToInt return the map[string]int value of a flag with the given name
91func (f *FlagSet) GetStringToInt(name string) (map[string]int, error) {
92 val, err := f.getFlagType(name, "stringToInt", stringToIntConv)
93 if err != nil {
94 return map[string]int{}, err
95 }
96 return val.(map[string]int), nil
97}
98
99// StringToIntVar defines a string flag with specified name, default value, and usage string.
100// The argument p points to a map[string]int variable in which to store the values of the multiple flags.

Callers 4

TestEmptyS2IFunction · 0.80
TestS2IFunction · 0.80
TestS2IDefaultFunction · 0.80
TestS2IWithDefaultFunction · 0.80

Calls 1

getFlagTypeMethod · 0.95

Tested by 4

TestEmptyS2IFunction · 0.64
TestS2IFunction · 0.64
TestS2IDefaultFunction · 0.64
TestS2IWithDefaultFunction · 0.64