| 1 | package getoptscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/ |
| 2 | |
| 3 | import ( |
| 4 | "flagscip-go gomod github.com/golang/go/src go1.16 flag/" |
| 5 | "strconvscip-go gomod github.com/golang/go/src go1.16 strconv/" |
| 6 | ) |
| 7 | |
| 8 | type boolFlagscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/boolFlag# interface { |
| 9 | flagscip-go gomod github.com/golang/go/src go1.16 flag/.Valuescip-go gomod github.com/golang/go/src go1.16 flag/Value# |
| 10 | IsBoolFlagscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/boolFlag#IsBoolFlag.() bool |
| 11 | } |
| 12 | |
| 13 | type boolValscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/boolVal# bool |
| 14 | |
| 15 | func (b *boolValscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/boolVal#) Stringscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/boolVal#String().() string { |
| 16 | return strconvscip-go gomod github.com/golang/go/src go1.16 strconv/.FormatBoolscip-go gomod github.com/golang/go/src go1.16 strconv/FormatBool().(bool(*b)) |
| 17 | } |
| 18 | |
| 19 | func (b *boolValscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/boolVal#) Setscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/boolVal#Set().(val string) error { |
| 20 | *b = boolValscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/boolVal#(true) |
| 21 | return nil |
| 22 | } |
| 23 | |
| 24 | func (b *boolValscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/boolVal#) IsBoolFlagscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/boolVal#IsBoolFlag().() bool { |
| 25 | return true |
| 26 | } |
| 27 | |
| 28 | // BoolVar defines a bool flag with specified name, default value, and |
| 29 | // usage string. The argument p points to a bool variable in which to |
| 30 | // store the value of the flag. |
| 31 | func (set *FlagSetscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/FlagSet#) BoolVarscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/FlagSet#BoolVar().(p *bool, name string, value bool, usage string) { |
| 32 | *p = value |
| 33 | set.Varscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/FlagSet#Var().((*boolValscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/boolVal#)(p), name, usage) |
| 34 | } |
| 35 | |
| 36 | // Bool defines a bool flag with specified name, default value, and |
| 37 | // usage string. The return value is the address of a bool variable that |
| 38 | // stores the value of the flag. |
| 39 | func (set *FlagSetscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/FlagSet#) Boolscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/FlagSet#Bool().(name string, value bool, usage string) *bool { |
| 40 | var b bool |
| 41 | set.BoolVarscip-go gomod git.sr.ht/~sircmpwn/getopt . `git.sr.ht/~sircmpwn/getopt`/FlagSet#BoolVar().(&b, name, value, usage) |
| 42 | return &b |
| 43 | } |