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