Documentation ¶
Index ¶
- Constants
- func UsageFunc(groups ...*Group) func() string
- type Flag
- type FlagGetter
- type FlagOpt
- type FlagRef
- type FlagSet
- func (f *FlagSet) Args() []string
- func (f *FlagSet) Bool(name, usage string, opts ...FlagOpt) *FlagRef[bool]
- func (f *FlagSet) FixedStringFlags(name, usage string, opts ...FlagOpt) *FlagRef[[][2]string]
- func (f *FlagSet) NewGroup(name string) *Group
- func (f *FlagSet) Parse(args []string) error
- func (f *FlagSet) String(name, usage string, opts ...FlagOpt) *FlagRef[string]
- func (f *FlagSet) StringFlags(name, usage string, opts ...FlagOpt) *FlagRef[[]string]
- func (f *FlagSet) Strings(name, usage string, opts ...FlagOpt) *FlagRef[[]string]
- type FlagType
- type Group
- type Value
Constants ¶
const (
CapNoLimit = -1
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FlagGetter ¶ added in v0.6.0
type FlagGetter interface {
Flag() *Flag
}
type FlagOpt ¶ added in v0.8.0
type FlagOpt func(*Flag)
func WithDenyDuplicate ¶
func WithDenyDuplicate() FlagOpt
WithDenyDuplicate Parse() returns an error if encountering duplicated flags are specified. This is used for a custom flag definition. Pre-defined flags(Bool/String etc) are enabled by default.
func WithShortName ¶ added in v0.7.0
type FlagRef ¶ added in v0.3.0
type FlagRef[T any] struct { // contains filtered or unexported fields }
FlagRef is a wrapper to access the Flag and the flag value.
func Register ¶ added in v0.7.0
Register registers a Value with a Name and an Usage as a Flag This is used to define a custom flag type.
type FlagSet ¶
type FlagSet struct { Usage func() string // contains filtered or unexported fields }
func NewFlagSet ¶
func (*FlagSet) FixedStringFlags ¶ added in v0.3.0
FixedStringFlags represents `-flag <value1> <value2> -flag <value3> <value4> -flag ...` This is a reference implementation
func (*FlagSet) NewGroup ¶
NewGroup grouping flags. `name` is used to output an error when invalid flag combinations are specified. `name` should be one of flag names.
func (*FlagSet) StringFlags ¶ added in v0.3.0
StringFlags represents `-flag <value1> -flag <value2> -flag <value3> -flag ...`
type Group ¶
type Group struct { Name string // contains filtered or unexported fields }
func LookupGroup ¶
func (*Group) AddDescription ¶
func (*Group) AddOptional ¶ added in v0.3.0
func (g *Group) AddOptional(fg FlagGetter) *Group
func (*Group) AddRequired ¶ added in v0.3.0
func (g *Group) AddRequired(fg FlagGetter) *Group
type Value ¶
type Value[T any] struct { // contains filtered or unexported fields }
Value please use NewValue(s) function instead of the definition