| 1 | package cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.22 context/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.22 fmt/" |
| 6 | "slicesscip-go gomod github.com/golang/go/src go1.22 slices/" |
| 7 | "stringsscip-go gomod github.com/golang/go/src go1.22 strings/" |
| 8 | ) |
| 9 | |
| 10 | var DefaultInverseBoolPrefixscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DefaultInverseBoolPrefix. = "no-" |
| 11 | |
| 12 | type BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag# struct { |
| 13 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name. string `json:"name"` // name of the flag |
| 14 | Categoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Category. string `json:"category"` // category of the flag, if any |
| 15 | DefaultTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#DefaultText. string `json:"defaultText"` // default text of the flag for usage purposes |
| 16 | HideDefaultscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#HideDefault. bool `json:"hideDefault"` // whether to hide the default value in output |
| 17 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Usage. string `json:"usage"` // usage string for help output |
| 18 | Sourcesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Sources. ValueSourceChainscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ValueSourceChain# `json:"-"` // sources to load flag value from |
| 19 | Requiredscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Required. bool `json:"required"` // whether the flag is required or not |
| 20 | Hiddenscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Hidden. bool `json:"hidden"` // whether to hide the flag in help output |
| 21 | Localscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Local. bool `json:"local"` // whether the flag needs to be applied to subcommands as well |
| 22 | Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Value. bool `json:"defaultValue"` // default value for this flag if not set by from any source |
| 23 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Destination. *bool `json:"-"` // destination pointer for value when set |
| 24 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Aliases. []string `json:"aliases"` // Aliases that are allowed for this flag |
| 25 | TakesFilescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#TakesFile. bool `json:"takesFileArg"` // whether this flag takes a file argument, mainly for shell completion purposes |
| 26 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Action. func(contextscip-go gomod github.com/golang/go/src go1.22 context/.Contextscip-go gomod github.com/golang/go/src go1.22 context/Context#, *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#, bool) error `json:"-"` // Action callback to be called when flag is set |
| 27 | OnlyOncescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#OnlyOnce. bool `json:"onlyOnce"` // whether this flag can be duplicated on the command line |
| 28 | Validatorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Validator. func(bool) error `json:"-"` // custom function to validate this flag value |
| 29 | ValidateDefaultsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#ValidateDefaults. bool `json:"validateDefaults"` // whether to validate defaults or not |
| 30 | Configscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Config. BoolConfigscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolConfig# `json:"config"` // Additional/Custom configuration associated with this flag type |
| 31 | InversePrefixscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#InversePrefix. string `json:"invPrefix"` // The prefix used to indicate a negative value. Default: `env` becomes `no-env` |
| 32 | |
| 33 | // unexported fields for internal use |
| 34 | countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#count. int // number of times the flag has been set |
| 35 | hasBeenSetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#hasBeenSet. bool // whether the flag has been set from env or file |
| 36 | appliedscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#applied. bool // whether the flag has been applied to a flag set already |
| 37 | valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#value. Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Value# // value representing this flag's value |
| 38 | psetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#pset. bool |
| 39 | nsetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#nset. bool |
| 40 | } |
| 41 | |
| 42 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) IsSetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#IsSet().() bool { |
| 43 | return bif.hasBeenSetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#hasBeenSet. |
| 44 | } |
| 45 | |
| 46 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) Getscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Get().() any { |
| 47 | return bif.valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#value..Getscip-go gomod github.com/golang/go/src go1.22 flag/Getter#Get().() |
| 48 | } |
| 49 | |
| 50 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) RunActionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#RunAction().(ctx contextscip-go gomod github.com/golang/go/src go1.22 context/.Contextscip-go gomod github.com/golang/go/src go1.22 context/Context#, cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 51 | if bif.Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Action. != nil { |
| 52 | return bif.Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Action.(ctx, cmd, bif.Getscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Get().().(bool)) |
| 53 | } |
| 54 | |
| 55 | return nil |
| 56 | } |
| 57 | |
| 58 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) IsLocalscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#IsLocal().() bool { |
| 59 | return bif.Localscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Local. |
| 60 | } |
| 61 | |
| 62 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) inversePrefixscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#inversePrefix().() string { |
| 63 | if bif.InversePrefixscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#InversePrefix. == "" { |
| 64 | bif.InversePrefixscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#InversePrefix. = DefaultInverseBoolPrefixscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DefaultInverseBoolPrefix. |
| 65 | } |
| 66 | |
| 67 | return bif.InversePrefixscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#InversePrefix. |
| 68 | } |
| 69 | |
| 70 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) PreParsescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#PreParse().() error { |
| 71 | count := bif.Configscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Config..Countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolConfig#Count. |
| 72 | if count == nil { |
| 73 | count = &bif.countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#count. |
| 74 | } |
| 75 | dest := bif.Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Destination. |
| 76 | if dest == nil { |
| 77 | dest = new(bool) |
| 78 | } |
| 79 | *dest = bif.Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Value. |
| 80 | bif.valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#value. = &boolValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#{ |
| 81 | destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#destination.: dest, |
| 82 | countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/boolValue#count.: count, |
| 83 | } |
| 84 | |
| 85 | // Validate the given default or values set from external sources as well |
| 86 | if bif.Validatorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Validator. != nil && bif.ValidateDefaultsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#ValidateDefaults. { |
| 87 | if err := bif.Validatorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Validator.(bif.valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#value..Getscip-go gomod github.com/golang/go/src go1.22 flag/Getter#Get().().(bool)); err != nil { |
| 88 | return err |
| 89 | } |
| 90 | } |
| 91 | bif.appliedscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#applied. = true |
| 92 | return nil |
| 93 | } |
| 94 | |
| 95 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) PostParsescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#PostParse().() error { |
| 96 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("postparse (flag=%[1]q)", bif.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name.) |
| 97 | |
| 98 | if !bif.hasBeenSetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#hasBeenSet. { |
| 99 | if val, source, found := bif.Sourcesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Sources..LookupWithSourcescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ValueSourceChain#LookupWithSource().(); found { |
| 100 | if val == "" { |
| 101 | val = "false" |
| 102 | } |
| 103 | if err := bif.Setscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Set().(bif.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name., val); err != nil { |
| 104 | return fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.22 fmt/Errorf().( |
| 105 | "could not parse %[1]q as %[2]T value from %[3]s for flag %[4]s: %[5]s", |
| 106 | val, bif.Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Value., source, bif.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name., err, |
| 107 | ) |
| 108 | } |
| 109 | |
| 110 | bif.hasBeenSetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#hasBeenSet. = true |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | return nil |
| 115 | } |
| 116 | |
| 117 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) Setscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Set().(name, val string) error { |
| 118 | if bif.countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#count. > 0 && bif.OnlyOncescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#OnlyOnce. { |
| 119 | return fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.22 fmt/Errorf().("can't duplicate this flag") |
| 120 | } |
| 121 | |
| 122 | bif.hasBeenSetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#hasBeenSet. = true |
| 123 | |
| 124 | if slicesscip-go gomod github.com/golang/go/src go1.22 slices/.Containsscip-go gomod github.com/golang/go/src go1.22 slices/Contains().(append([]string{bif.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name.}, bif.Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Aliases....), name) { |
| 125 | if bif.nsetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#nset. { |
| 126 | return fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.22 fmt/Errorf().("cannot set both flags `--%s` and `--%s`", bif.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name., bif.inversePrefixscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#inversePrefix().()+bif.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name.) |
| 127 | } |
| 128 | if err := bif.valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#value..Setscip-go gomod github.com/golang/go/src go1.22 flag/Value#Set().(val); err != nil { |
| 129 | return err |
| 130 | } |
| 131 | bif.psetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#pset. = true |
| 132 | } else { |
| 133 | if bif.psetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#pset. { |
| 134 | return fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.22 fmt/Errorf().("cannot set both flags `--%s` and `--%s`", bif.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name., bif.inversePrefixscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#inversePrefix().()+bif.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name.) |
| 135 | } |
| 136 | if err := bif.valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#value..Setscip-go gomod github.com/golang/go/src go1.22 flag/Value#Set().("false"); err != nil { |
| 137 | return err |
| 138 | } |
| 139 | bif.nsetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#nset. = true |
| 140 | } |
| 141 | |
| 142 | if bif.Validatorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Validator. != nil { |
| 143 | return bif.Validatorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Validator.(bif.valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#value..Getscip-go gomod github.com/golang/go/src go1.22 flag/Getter#Get().().(bool)) |
| 144 | } |
| 145 | return nil |
| 146 | } |
| 147 | |
| 148 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) Namesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Names().() []string { |
| 149 | names := append([]string{bif.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name.}, bif.Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Aliases....) |
| 150 | |
| 151 | for _, name := range names { |
| 152 | names = append(names, bif.inversePrefixscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#inversePrefix().()+name) |
| 153 | } |
| 154 | |
| 155 | return names |
| 156 | } |
| 157 | |
| 158 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) IsRequiredscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#IsRequired().() bool { |
| 159 | return bif.Requiredscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Required. |
| 160 | } |
| 161 | |
| 162 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) IsVisiblescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#IsVisible().() bool { |
| 163 | return !bif.Hiddenscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Hidden. |
| 164 | } |
| 165 | |
| 166 | // String implements the standard Stringer interface. |
| 167 | // |
| 168 | // Example for BoolFlag{Name: "env"} |
| 169 | // --[no-]env (default: false) |
| 170 | // |
| 171 | // Example for BoolFlag{Name: "env", Aliases: []string{"e"}} |
| 172 | // --[no-]env, -e (default: false) |
| 173 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) Stringscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#String().() string { |
| 174 | out := FlagStringerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagStringer.(bif) |
| 175 | |
| 176 | i := stringsscip-go gomod github.com/golang/go/src go1.22 strings/.Indexscip-go gomod github.com/golang/go/src go1.22 strings/Index().(out, "\t") |
| 177 | |
| 178 | prefix := "--" |
| 179 | |
| 180 | // single character flags are prefixed with `-` instead of `--` |
| 181 | if len(bif.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name.) == 1 { |
| 182 | prefix = "-" |
| 183 | } |
| 184 | |
| 185 | // Guard against a FlagStringer that returns a string without a tab (e.g. |
| 186 | // a custom stringer or the default stringer when the flag does not |
| 187 | // implement DocGenerationFlag). In that case treat the entire output as |
| 188 | // the tab-delimited suffix so the slice never goes out of bounds. |
| 189 | if i < 0 { |
| 190 | i = 0 |
| 191 | } |
| 192 | |
| 193 | var aliasParts []string |
| 194 | for _, alias := range bif.Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Aliases. { |
| 195 | aPrefix := "--" |
| 196 | if len(alias) == 1 { |
| 197 | aPrefix = "-" |
| 198 | } |
| 199 | aliasParts = append(aliasParts, aPrefix+alias) |
| 200 | } |
| 201 | |
| 202 | names := fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.22 fmt/Sprintf().("%s[%s]%s", prefix, bif.inversePrefixscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#inversePrefix().(), bif.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name.) |
| 203 | if len(aliasParts) > 0 { |
| 204 | names = names + ", " + stringsscip-go gomod github.com/golang/go/src go1.22 strings/.Joinscip-go gomod github.com/golang/go/src go1.22 strings/Join().(aliasParts, ", ") |
| 205 | } |
| 206 | |
| 207 | return fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.22 fmt/Sprintf().("%s%s", names, out[i:]) |
| 208 | } |
| 209 | |
| 210 | // IsBoolFlag returns whether the flag doesn't need to accept args |
| 211 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) IsBoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#IsBoolFlag().() bool { |
| 212 | return true |
| 213 | } |
| 214 | |
| 215 | // Count returns the number of times this flag has been invoked |
| 216 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) Countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Count().() int { |
| 217 | return bif.countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#count. |
| 218 | } |
| 219 | |
| 220 | // GetDefaultText returns the default text for this flag |
| 221 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) GetDefaultTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#GetDefaultText().() string { |
| 222 | if bif.Requiredscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Required. { |
| 223 | return bif.DefaultTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#DefaultText. |
| 224 | } |
| 225 | return 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().(bif.Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Value.) |
| 226 | } |
| 227 | |
| 228 | // GetCategory returns the category of the flag |
| 229 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) GetCategoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#GetCategory().() string { |
| 230 | return bif.Categoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Category. |
| 231 | } |
| 232 | |
| 233 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) SetCategoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#SetCategory().(c string) { |
| 234 | bif.Categoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Category. = c |
| 235 | } |
| 236 | |
| 237 | // GetUsage returns the usage string for the flag |
| 238 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) GetUsagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#GetUsage().() string { |
| 239 | return bif.Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Usage. |
| 240 | } |
| 241 | |
| 242 | // GetEnvVars returns the env vars for this flag |
| 243 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) GetEnvVarsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#GetEnvVars().() []string { |
| 244 | return bif.Sourcesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Sources..EnvKeysscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ValueSourceChain#EnvKeys().() |
| 245 | } |
| 246 | |
| 247 | // GetValue returns the flags value as string representation and an empty |
| 248 | // string if the flag takes no value at all. |
| 249 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) GetValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#GetValue().() string { |
| 250 | return "" |
| 251 | } |
| 252 | |
| 253 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) TakesValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#TakesValue().() bool { |
| 254 | return false |
| 255 | } |
| 256 | |
| 257 | // IsDefaultVisible returns true if the flag is not hidden, otherwise false |
| 258 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) IsDefaultVisiblescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#IsDefaultVisible().() bool { |
| 259 | return !bif.HideDefaultscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#HideDefault. |
| 260 | } |
| 261 | |
| 262 | // TypeName is used for stringify/docs. For bool its a no-op |
| 263 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) TypeNamescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#TypeName().() string { |
| 264 | return "bool" |
| 265 | } |
| 266 | |
| 267 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) SchemaTypescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#SchemaType().() string { |
| 268 | return "boolean" |
| 269 | } |
| 270 | |
| 271 | func (bif *BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#) SchemaItemsTypescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#SchemaItemsType().() string { |
| 272 | return "" |
| 273 | } |