| 1 | package cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ |
| 2 | |
| 3 | import ( |
| 4 | "errorsscip-go gomod github.com/golang/go/src go1.22 errors/" |
| 5 | "strconvscip-go gomod github.com/golang/go/src go1.22 strconv/" |
| 6 | ) |
| 7 | |
| 8 | type BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag# = FlagBasescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#[bool, BoolConfigscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolConfig#, boolValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#] |
| 9 | |
| 10 | // BoolConfig defines the configuration for bool flags |
| 11 | type BoolConfigscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolConfig# struct { |
| 12 | Countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolConfig#Count. *int |
| 13 | } |
| 14 | |
| 15 | // boolValue needs to implement the boolFlag internal interface in flag |
| 16 | // to be able to capture bool fields and values |
| 17 | // |
| 18 | // type boolFlag interface { |
| 19 | // Value |
| 20 | // IsBoolFlag() bool |
| 21 | // } |
| 22 | type boolValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue# struct { |
| 23 | destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#destination. *bool |
| 24 | countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#count. *int |
| 25 | } |
| 26 | |
| 27 | func (cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) Boolscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Bool().(name string) bool { |
| 28 | if v, ok := cmd.Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Value().(name).(bool); ok { |
| 29 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("bool available for flag name %[1]q with value=%[2]v (cmd=%[3]q)", name, v, cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 30 | return v |
| 31 | } |
| 32 | |
| 33 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("bool NOT available for flag name %[1]q (cmd=%[2]q)", name, cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 34 | return false |
| 35 | } |
| 36 | |
| 37 | // Below functions are to satisfy the ValueCreator interface |
| 38 | |
| 39 | // Create creates the bool value |
| 40 | func (b boolValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#) Createscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#Create().(val bool, p *bool, c BoolConfigscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolConfig#) Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Value# { |
| 41 | *p = val |
| 42 | if c.Countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolConfig#Count. == nil { |
| 43 | c.Countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolConfig#Count. = new(int) |
| 44 | } |
| 45 | return &boolValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#{ |
| 46 | destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#destination.: p, |
| 47 | countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#count.: c.Countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolConfig#Count., |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | // ToString formats the bool value |
| 52 | func (b boolValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#) ToStringscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#ToString().(value bool) string { |
| 53 | b.destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#destination. = &value |
| 54 | return b.Stringscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#String().() |
| 55 | } |
| 56 | |
| 57 | // Below functions are to satisfy the flag.Value interface |
| 58 | |
| 59 | func (b *boolValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#) Setscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#Set().(s string) error { |
| 60 | v, err := strconvscip-go gomod github.com/golang/go/src go1.22 strconv/.ParseBoolscip-go gomod github.com/golang/go/src go1.22 strconv/ParseBool().(s) |
| 61 | if err != nil { |
| 62 | err = errorsscip-go gomod github.com/golang/go/src go1.22 errors/.Newscip-go gomod github.com/golang/go/src go1.22 errors/New().("parse error") |
| 63 | return err |
| 64 | } |
| 65 | *b.destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#destination. = v |
| 66 | if b.countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#count. != nil { |
| 67 | *b.countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#count. = *b.countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#count. + 1 |
| 68 | } |
| 69 | return err |
| 70 | } |
| 71 | |
| 72 | func (b *boolValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#) Getscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#Get().() any { return *b.destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#destination. } |
| 73 | |
| 74 | func (b *boolValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#) Stringscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#String().() string { |
| 75 | return strconvscip-go gomod github.com/golang/go/src go1.22 strconv/.FormatBoolscip-go gomod github.com/golang/go/src go1.22 strconv/FormatBool().(*b.destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#destination.) |
| 76 | } |
| 77 | |
| 78 | func (b *boolValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#) IsBoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#IsBoolFlag().() bool { return true } |