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

Method GetStringArray

string_array.go:67–73  ·  string_array.go::FlagSet.GetStringArray

GetStringArray return the []string value of a flag with the given name

(name string)

Source from the content-addressed store, hash-verified

65
66// GetStringArray return the []string value of a flag with the given name
67func (f *FlagSet) GetStringArray(name string) ([]string, error) {
68 val, err := f.getFlagType(name, "stringArray", stringArrayConv)
69 if err != nil {
70 return []string{}, err
71 }
72 return val.([]string), nil
73}
74
75// StringArrayVar defines a string flag with specified name, default value, and usage string.
76// The argument p points to a []string variable in which to store the values of the multiple flags.

Callers 7

TestEmptySAFunction · 0.80
TestEmptySAValueFunction · 0.80
TestSADefaultFunction · 0.80
TestSAWithDefaultFunction · 0.80
TestSACalledTwiceFunction · 0.80
TestSAWithSpecialCharFunction · 0.80
TestSAWithSquareBracketsFunction · 0.80

Calls 1

getFlagTypeMethod · 0.95

Tested by 7

TestEmptySAFunction · 0.64
TestEmptySAValueFunction · 0.64
TestSADefaultFunction · 0.64
TestSAWithDefaultFunction · 0.64
TestSACalledTwiceFunction · 0.64
TestSAWithSpecialCharFunction · 0.64
TestSAWithSquareBracketsFunction · 0.64