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

Method Duration

duration.go:64–68  ·  view source on GitHub ↗

Duration defines a time.Duration flag with specified name, default value, and usage string. The return value is the address of a time.Duration variable that stores the value of the flag.

(name string, value time.Duration, usage string)

Source from the content-addressed store, hash-verified

62// Duration defines a time.Duration flag with specified name, default value, and usage string.
63// The return value is the address of a time.Duration variable that stores the value of the flag.
64func (f *FlagSet) Duration(name string, value time.Duration, usage string) *time.Duration {
65 p := new(time.Duration)
66 f.DurationVarP(p, name, "", value, usage)
67 return p
68}
69
70// DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash.
71func (f *FlagSet) DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration {

Callers 4

TestPrintDefaultsFunction · 0.95
TestToGoflagsFunction · 0.95
TestDSAsSliceValueFunction · 0.80
testParseFunction · 0.80

Calls 1

DurationVarPMethod · 0.95

Tested by 4

TestPrintDefaultsFunction · 0.76
TestToGoflagsFunction · 0.76
TestDSAsSliceValueFunction · 0.64
testParseFunction · 0.64