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

Method GetDurationSlice

duration_slice.go:112–118  ·  view source on GitHub ↗

GetDurationSlice returns the []time.Duration value of a flag with the given name

(name string)

Source from the content-addressed store, hash-verified

110
111// GetDurationSlice returns the []time.Duration value of a flag with the given name
112func (f *FlagSet) GetDurationSlice(name string) ([]time.Duration, error) {
113 val, err := f.getFlagType(name, "durationSlice", durationSliceConv)
114 if err != nil {
115 return []time.Duration{}, err
116 }
117 return val.([]time.Duration), nil
118}
119
120// DurationSliceVar defines a durationSlice flag with specified name, default value, and usage string.
121// The argument p points to a []time.Duration variable in which to store the value of the flag.

Callers 4

TestEmptyDSFunction · 0.80
TestDSFunction · 0.80
TestDSDefaultFunction · 0.80
TestDSWithDefaultFunction · 0.80

Calls 1

getFlagTypeMethod · 0.95

Tested by 4

TestEmptyDSFunction · 0.64
TestDSFunction · 0.64
TestDSDefaultFunction · 0.64
TestDSWithDefaultFunction · 0.64