Documentation
¶
Overview ¶
Package flag extends the stdlib flag package, adding support for checked values.
Index ¶
- Variables
- type ErrorHandling
- type Flag
- type FlagSet
- func (f *FlagSet) Duration(name string, value time.Duration, usage string, ...) *time.Duration
- func (f *FlagSet) DurationVar(p *time.Duration, name string, value time.Duration, usage string, ...)
- func (f *FlagSet) Float64(name string, value float64, usage string, checks ...value.CheckFunc[float64]) *float64
- func (f *FlagSet) Float64Var(p *float64, name string, value float64, usage string, ...)
- func (f *FlagSet) Int(name string, value int, usage string, checks ...value.CheckFunc[int]) *int
- func (f *FlagSet) Int64(name string, value int64, usage string, checks ...value.CheckFunc[int64]) *int64
- func (f *FlagSet) Int64Var(p *int64, name string, value int64, usage string, ...)
- func (f *FlagSet) IntVar(p *int, name string, value int, usage string, checks ...value.CheckFunc[int])
- func (f *FlagSet) String(name string, value string, usage string, checks ...value.CheckFunc[string]) *string
- func (f *FlagSet) StringVar(p *string, name string, value string, usage string, ...)
- func (f *FlagSet) Uint(name string, value uint, usage string, checks ...value.CheckFunc[uint]) *uint
- func (f *FlagSet) Uint64(name string, value uint64, usage string, checks ...value.CheckFunc[uint64]) *uint64
- func (f *FlagSet) Uint64Var(p *uint64, name string, value uint64, usage string, ...)
- func (f *FlagSet) UintVar(p *uint, name string, value uint, usage string, ...)
- type Value
Constants ¶
This section is empty.
Variables ¶
var ( ContinueOnError = flag.ContinueOnError ExitOnError = flag.ExitOnError PanicOnError = flag.PanicOnError )
Aliases for the flag.ErrorHandling values.
Functions ¶
This section is empty.
Types ¶
type ErrorHandling ¶
type ErrorHandling = flag.ErrorHandling
ErrorHandling aliases the flag.ErrorHandling type.
type FlagSet ¶
FlagSet extends the flag.FlagSet type, adding support for checked flag values. Its flag definition methods behave in the same way as those of flag.FlagSet, with the addition of a final variadic parameter that can be used to add value checks to the flag.
func NewFlagSet ¶
func NewFlagSet(name string, errorHandling flag.ErrorHandling) *FlagSet
NewFlagSet creates a new extended FlagSet.
func (*FlagSet) Duration ¶
func (f *FlagSet) Duration(name string, value time.Duration, usage string, checks ...value.CheckFunc[time.Duration]) *time.Duration
Duration behaves as flag.FlagSet.Duration, with an additional variadic parameter allowing checks to be applied to the parsed value.
func (*FlagSet) DurationVar ¶
func (f *FlagSet) DurationVar(p *time.Duration, name string, value time.Duration, usage string, checks ...value.CheckFunc[time.Duration])
DurationVar behaves as flag.FlagSet.DurationVar, with an additional variadic parameter allowing checks to be applied to the parsed value.
func (*FlagSet) Float64 ¶ added in v0.3.0
func (f *FlagSet) Float64(name string, value float64, usage string, checks ...value.CheckFunc[float64]) *float64
Float64 behaves as flag.FlagSet.Float64, with an additional variadic parameter allowing checks to be applied to the parsed value.
func (*FlagSet) Float64Var ¶ added in v0.3.0
func (f *FlagSet) Float64Var(p *float64, name string, value float64, usage string, checks ...value.CheckFunc[float64])
Float64Var behaves as flag.FlagSet.Float64Var, with an additional variadic parameter allowing checks to be applied to the parsed value.
func (*FlagSet) Int ¶
Int behaves as flag.FlagSet.Int, with an additional variadic parameter allowing checks to be applied to the parsed value.
func (*FlagSet) Int64 ¶ added in v0.3.0
func (f *FlagSet) Int64(name string, value int64, usage string, checks ...value.CheckFunc[int64]) *int64
Int64 behaves as flag.FlagSet.Int64, with an additional variadic parameter allowing checks to be applied to the parsed value.
func (*FlagSet) Int64Var ¶ added in v0.3.0
func (f *FlagSet) Int64Var(p *int64, name string, value int64, usage string, checks ...value.CheckFunc[int64])
Int64Var behaves as flag.FlagSet.Int64Var, with an additional variadic parameter allowing checks to be applied to the parsed value.
func (*FlagSet) IntVar ¶
func (f *FlagSet) IntVar(p *int, name string, value int, usage string, checks ...value.CheckFunc[int])
IntVar behaves as flag.FlagSet.IntVar, with an additional variadic parameter allowing checks to be applied to the parsed value.
func (*FlagSet) String ¶
func (f *FlagSet) String(name string, value string, usage string, checks ...value.CheckFunc[string]) *string
String behaves as flag.FlagSet.String, with an additional variadic parameter allowing checks to be applied to the parsed value.
func (*FlagSet) StringVar ¶
func (f *FlagSet) StringVar(p *string, name string, value string, usage string, checks ...value.CheckFunc[string])
StringVar behaves as flag.FlagSet.StringVar, with an additional variadic parameter allowing checks to be applied to the parsed value.
func (*FlagSet) Uint ¶ added in v0.3.0
func (f *FlagSet) Uint(name string, value uint, usage string, checks ...value.CheckFunc[uint]) *uint
Uint behaves as flag.FlagSet.Uint, with an additional variadic parameter allowing checks to be applied to the parsed value.
func (*FlagSet) Uint64 ¶ added in v0.3.0
func (f *FlagSet) Uint64(name string, value uint64, usage string, checks ...value.CheckFunc[uint64]) *uint64
Uint64 behaves as flag.FlagSet.Uint64, with an additional variadic parameter allowing checks to be applied to the parsed value.