A FlagSet represents a set of defined flags.
| 154 | |
| 155 | // A FlagSet represents a set of defined flags. |
| 156 | type FlagSet struct { |
| 157 | // Usage is the function called when an error occurs while parsing flags. |
| 158 | // The field is a function (not a method) that may be changed to point to |
| 159 | // a custom error handler. |
| 160 | Usage func() |
| 161 | |
| 162 | // SortFlags is used to indicate, if user wants to have sorted flags in |
| 163 | // help/usage messages. |
| 164 | SortFlags bool |
| 165 | |
| 166 | // ParseErrorsAllowlist is used to configure an allowlist of errors |
| 167 | ParseErrorsAllowlist ParseErrorsAllowlist |
| 168 | |
| 169 | // ParseErrorsAllowlist is used to configure an allowlist of errors. |
| 170 | // |
| 171 | // Deprecated: use [FlagSet.ParseErrorsAllowlist] instead. This field will be removed in a future release. |
| 172 | ParseErrorsWhitelist ParseErrorsAllowlist |
| 173 | |
| 174 | name string |
| 175 | parsed bool |
| 176 | actual map[NormalizedName]*Flag |
| 177 | orderedActual []*Flag |
| 178 | sortedActual []*Flag |
| 179 | formal map[NormalizedName]*Flag |
| 180 | orderedFormal []*Flag |
| 181 | sortedFormal []*Flag |
| 182 | shorthands map[byte]*Flag |
| 183 | args []string // arguments after flags |
| 184 | argsLenAtDash int // len(args) when a '--' was located when parsing, or -1 if no -- |
| 185 | errorHandling ErrorHandling |
| 186 | output io.Writer // nil means stderr; use Output() accessor |
| 187 | interspersed bool // allow interspersed option/non-option args |
| 188 | normalizeNameFunc func(f *FlagSet, name string) NormalizedName |
| 189 | |
| 190 | addedGoFlagSets []*goflag.FlagSet |
| 191 | } |
| 192 | |
| 193 | // A Flag represents the state of a flag. |
| 194 | type Flag struct { |
nothing calls this directly
no outgoing calls
no test coverage detected