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

Method TextVar

text.go:64–66  ·  view source on GitHub ↗

TextVar defines a flag with a specified name, default value, and usage string. The argument p must be a pointer to a variable that will hold the value of the flag, and p must implement encoding.TextUnmarshaler. If the flag is used, the flag value will be passed to p's UnmarshalText method. The type

(p encoding.TextUnmarshaler, name string, value encoding.TextMarshaler, usage string)

Source from the content-addressed store, hash-verified

62
63// TextVar defines a flag with a specified name, default value, and usage string. The argument p must be a pointer to a variable that will hold the value of the flag, and p must implement encoding.TextUnmarshaler. If the flag is used, the flag value will be passed to p's UnmarshalText method. The type of the default value must be the same as the type of p.
64func (f *FlagSet) TextVar(p encoding.TextUnmarshaler, name string, value encoding.TextMarshaler, usage string) {
65 f.VarP(newTextValue(value, p), name, "", usage)
66}
67
68// TextVarP is like TextVar, but accepts a shorthand letter that can be used after a single dash.
69func (f *FlagSet) TextVarP(p encoding.TextUnmarshaler, name, shorthand string, value encoding.TextMarshaler, usage string) {

Callers 1

setUpTimeFunction · 0.95

Calls 2

VarPMethod · 0.95
newTextValueFunction · 0.85

Tested by 1

setUpTimeFunction · 0.76