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

Method BoolFuncP

bool_func.go:23–27  ·  view source on GitHub ↗

BoolFuncP is like BoolFunc, but accepts a shorthand letter that can be used after a single dash.

(name, shorthand string, usage string, fn func(string) error)

Source from the content-addressed store, hash-verified

21
22// BoolFuncP is like BoolFunc, but accepts a shorthand letter that can be used after a single dash.
23func (f *FlagSet) BoolFuncP(name, shorthand string, usage string, fn func(string) error) {
24 var val Value = boolfuncValue(fn)
25 flag := f.VarPF(val, name, shorthand, usage)
26 flag.NoOptDefVal = "true"
27}
28
29// BoolFunc defines a func flag with specified name, callback function and usage string.
30//

Callers 4

TestBoolFuncPFunction · 0.95
BoolFuncMethod · 0.95
BoolFuncFunction · 0.80
BoolFuncPFunction · 0.80

Calls 2

VarPFMethod · 0.95
boolfuncValueFuncType · 0.85

Tested by 1

TestBoolFuncPFunction · 0.76