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

Method BoolFunc

bool_func.go:18–20  ·  view source on GitHub ↗

BoolFunc defines a func flag with specified name, callback function and usage string. The callback function will be called every time "--{name}" (or any form that matches the flag) is parsed on the command line.

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

Source from the content-addressed store, hash-verified

16// The callback function will be called every time "--{name}" (or any form that matches the flag) is parsed
17// on the command line.
18func (f *FlagSet) BoolFunc(name string, usage string, fn func(string) error) {
19 f.BoolFuncP(name, "", usage, fn)
20}
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) {

Callers 2

TestBoolFuncFunction · 0.95
TestBoolFuncUsageFunction · 0.95

Calls 1

BoolFuncPMethod · 0.95

Tested by 2

TestBoolFuncFunction · 0.76
TestBoolFuncUsageFunction · 0.76