Versions in this module Expand all Collapse all v0 v0.12.0 Dec 27, 2022 Changes in this version + const ErrBadFlag + const ErrEmptyArgName + const ErrInvalidValue + const ErrUndefinedFlag + const ErrValueMissing + const ErrValueOverflow + func HandleCmdErrorByPrintingHelp(c *Cmd, copts *CmdOptions, err error) (ignore bool) + func ParseFlags(flags FlagIndexer, args []string, opts *ParseOptions) (nParsed, posDoubleDash int, posArgs []string, err error) + func ParseFlagsLowLevel(flags FlagIndexer, args []string, opts *ParseOptions, ...) (nParsed, posDoubleDash int, posArgs []string, err error) + type Bool = ImplicitFlag[bool, BoolParser[bool]] + type BoolParser struct + func (BoolParser[T]) ParseValue(opts *ParseOptions, arg string, out *T) (err error) + type BoolSlice = ImplicitFlag[[]bool, SliceParser[bool, BoolParser[bool]]] + type Cmd struct + Children []*Cmd + Extra any + Flags FlagIndexer + LocalFlags FlagIndexer + Name string + Parent *Cmd + PostRun func(c, from *Cmd, copts *CmdOptions, runErr error) error + PreRun func(c *Cmd, copts *CmdOptions, popts *ParseOptions, unparsedArgs []string) error + Run func(c *Cmd, copts *CmdOptions, posArgs, argsAfterDD []string) error + func (c *Cmd) Exec(copts *CmdOptions, popts *ParseOptions, args []string) (err error) + func (c *Cmd) FormatCmdPath(w io.StringWriter) (n int, err error) + func (c *Cmd) IndexFlag(i int) (f Flag) + func (c *Cmd) LinkChildren(recursive bool) + func (c *Cmd) SearchFlag(name string) (f Flag) + type CmdErrorHandleFunc = func(c *Cmd, copts *CmdOptions, cmdErr error) (err error) + type CmdHelp struct + Changelog string + Deprecation string + Example string + Long string + Pattern string + Short string + func (m *CmdHelp) WriteHelp(c *Cmd, copts *CmdOptions, out io.StringWriter) + type CmdOptions struct + HandleError CmdErrorHandleFunc + Stderr io.Writer + Stdin io.Reader + Stdout io.Writer + type Duration = ExplicitFlag[time.Duration, DurationParser[time.Duration]] + type DurationParser struct + func (DurationParser[T]) ParseValue(opts *ParseOptions, arg string, out *T) (err error) + type DurationSlice = ExplicitFlag[[]time.Duration, SliceParser[time.Duration, DurationParser[time.Duration]]] + type DurationSum = ImplicitFlag[time.Duration, SumParser[time.Duration, DurationParser[time.Duration]]] + type ExplicitFlag struct + Extra any + Marks FlagMark + ValueOut *T + func (*ExplicitFlag[T, P]) ValueImplied(opts *ParseOptions, set bool) bool + func (f *ExplicitFlag[T, P]) Changed() bool + func (f *ExplicitFlag[T, P]) Decode(ctx *ParseOptions, arg string) error + func (f *ExplicitFlag[T, P]) Ext() any + type Flag interface + Decode func(opts *ParseOptions, arg string) error + Ext func() any + ValueImplied func(opts *ParseOptions, set bool) bool + type FlagErrorHandleFunc = func(opts *ParseOptions, args []string, i int, argErr error) (err error) + type FlagHelp struct + Changelog string + Deprecation string + Name string + Shorthand string + Usage string + ValidValues func(c *Cmd) []string + func (h *FlagHelp) WriteHelp(c *Cmd, copts *CmdOptions, out io.StringWriter) + type FlagIndexer interface + IndexFlag func(i int) Flag + SearchFlag func(name string) Flag + type FlagMark uint32 + const FlagMark_Changed + const FlagMark_Hidden + const FlagMark_Required + func (m FlagMark) Changed() bool + func (m FlagMark) Hidden() bool + func (m FlagMark) Required() bool + type Float32 = ExplicitFlag[float32, FloatParser[float32]] + type Float32Slice = ExplicitFlag[[]float32, SliceParser[float32, FloatParser[float32]]] + type Float32Sum = ImplicitFlag[float32, SumParser[float32, FloatParser[float32]]] + type Float64 = ExplicitFlag[float64, FloatParser[float64]] + type Float64Slice = ExplicitFlag[[]float64, SliceParser[float64, FloatParser[float64]]] + type Float64Sum = ImplicitFlag[float64, SumParser[float64, FloatParser[float64]]] + type FloatParser struct + func (FloatParser[T]) ParseValue(opts *ParseOptions, arg string, out *T) (err error) + type FuncIndexer func(name string, index int) Flag + func (f FuncIndexer) IndexFlag(i int) Flag + func (f FuncIndexer) SearchFlag(name string) Flag + type Helper interface + WriteHelp func(c *Cmd, copts *CmdOptions, w io.StringWriter) + type ImplicitFlag ExplicitFlag[T, P] + func (f *ImplicitFlag[T, P]) Changed() bool + func (f *ImplicitFlag[T, P]) Decode(ctx *ParseOptions, arg string) error + func (f *ImplicitFlag[T, P]) Ext() any + func (f *ImplicitFlag[T, P]) ValueImplied(ctx *ParseOptions, set bool) bool + type Int = ExplicitFlag[int, IntParser[int]] + type Int16 = ExplicitFlag[int16, IntParser[int16]] + type Int16Slice = ExplicitFlag[[]int16, SliceParser[int16, IntParser[int16]]] + type Int16Sum = ImplicitFlag[int16, SumParser[int16, IntParser[int16]]] + type Int32 = ExplicitFlag[int32, IntParser[int32]] + type Int32Slice = ExplicitFlag[[]int32, SliceParser[int32, IntParser[int32]]] + type Int32Sum = ImplicitFlag[int32, SumParser[int32, IntParser[int32]]] + type Int64 = ExplicitFlag[int64, IntParser[int64]] + type Int64Slice = ExplicitFlag[[]int64, SliceParser[int64, IntParser[int64]]] + type Int64Sum = ImplicitFlag[int64, SumParser[int64, IntParser[int64]]] + type Int8 = ExplicitFlag[int8, IntParser[int8]] + type Int8Slice = ExplicitFlag[[]int8, SliceParser[int8, IntParser[int8]]] + type Int8Sum = ImplicitFlag[int8, SumParser[int8, IntParser[int8]]] + type IntParser struct + func (IntParser[T]) ParseValue(opts *ParseOptions, arg string, out *T) (err error) + type IntSlice = ExplicitFlag[[]int, SliceParser[int, IntParser[int]]] + type IntSum = ImplicitFlag[int, SumParser[int, IntParser[int]]] + type MapIndexer struct + func NewMapIndexer() *MapIndexer + func (m *MapIndexer) Add(flag Flag, names ...string) *MapIndexer + func (m *MapIndexer) IndexFlag(i int) Flag + func (m *MapIndexer) SearchFlag(name string) Flag + type ParseOptions struct + DryRun bool + HandleError FlagErrorHandleFunc + PosArgsBuffer []string + StartTime time.Time + type RegExp = ExplicitFlag[regexp.Regexp, RegExpParser[regexp.Regexp]] + type RegExpNoCase = ExplicitFlag[regexp.Regexp, RegExpNoCaseParser[regexp.Regexp]] + type RegExpNoCaseParser struct + func (RegExpNoCaseParser[T]) ParseValue(opts *ParseOptions, arg string, out *T) (err error) + type RegExpParser struct + func (RegExpParser[T]) ParseValue(opts *ParseOptions, arg string, out *T) (err error) + type RegexpNoCaseSlice = ExplicitFlag[[]regexp.Regexp, SliceParser[regexp.Regexp, RegExpNoCaseParser[regexp.Regexp]]] + type RegexpSlice = ExplicitFlag[[]regexp.Regexp, SliceParser[regexp.Regexp, RegExpParser[regexp.Regexp]]] + type Size = ExplicitFlag[int64, SizeParser[int64]] + type SizeParser struct + func (SizeParser[T]) ParseValue(opts *ParseOptions, arg string, out *T) (err error) + type SizeSlice = ExplicitFlag[[]int64, SliceParser[int64, SizeParser[int64]]] + type SizeSum = ImplicitFlag[int64, SumParser[int64, SizeParser[int64]]] + type SliceParser struct + func (SliceParser[T, P]) ParseValue(opts *ParseOptions, arg string, out *[]T) (err error) + type String = ExplicitFlag[string, StringParser[string]] + type StringParser struct + func (StringParser[T]) ParseValue(opts *ParseOptions, arg string, out *T) error + type StringSlice = ExplicitFlag[[]string, SliceParser[string, StringParser[string]]] + type SumParser struct + func (SumParser[T, P]) ParseValue(opts *ParseOptions, arg string, out *T) (err error) + type Time = ExplicitFlag[time.Time, TimeParser[time.Time]] + type TimeParser struct + func (TimeParser[T]) ParseValue(opts *ParseOptions, arg string, out *T) (err error) + type TimeSlice = ExplicitFlag[[]time.Time, SliceParser[time.Time, TimeParser[time.Time]]] + type Uint = ExplicitFlag[uint, IntParser[uint]] + type Uint16 = ExplicitFlag[uint16, IntParser[uint16]] + type Uint16Slice = ExplicitFlag[[]uint16, SliceParser[uint16, IntParser[uint16]]] + type Uint16Sum = ImplicitFlag[uint16, SumParser[uint16, IntParser[uint16]]] + type Uint32 = ExplicitFlag[uint32, IntParser[uint32]] + type Uint32Slice = ExplicitFlag[[]uint32, SliceParser[uint32, IntParser[uint32]]] + type Uint32Sum = ImplicitFlag[uint32, SumParser[uint32, IntParser[uint32]]] + type Uint64 = ExplicitFlag[uint64, IntParser[uint64]] + type Uint64Slice = ExplicitFlag[[]uint64, SliceParser[uint64, IntParser[uint64]]] + type Uint64Sum = ImplicitFlag[uint64, SumParser[uint64, IntParser[uint64]]] + type Uint8 = ExplicitFlag[uint8, IntParser[uint8]] + type Uint8Slice = ExplicitFlag[[]uint8, SliceParser[uint8, IntParser[uint8]]] + type Uint8Sum = ImplicitFlag[uint8, SumParser[uint8, IntParser[uint8]]] + type UintSlice = ExplicitFlag[[]uint, SliceParser[uint, IntParser[uint]]] + type UintSum = ImplicitFlag[uint, SumParser[uint, IntParser[uint]]] + type Uintptr = ExplicitFlag[uintptr, IntParser[uintptr]] + type UintptrSlice = ExplicitFlag[[]uintptr, SliceParser[uintptr, IntParser[uintptr]]] + type UintptrSum = ImplicitFlag[uintptr, SumParser[uintptr, IntParser[uintptr]]] + type UnixMilli = ExplicitFlag[int64, UnixMilliParser[int64]] + type UnixMilliParser struct + func (UnixMilliParser[T]) ParseValue(opts *ParseOptions, arg string, out *T) (err error) + type UnixMilliSlice = ExplicitFlag[[]int64, SliceParser[int64, UnixMilliParser[int64]]] + type UnixNano = ExplicitFlag[int64, UnixNanoParser[int64]] + type UnixNanoParser struct + func (UnixNanoParser[T]) ParseValue(opts *ParseOptions, arg string, out *T) (err error) + type UnixNanoSlice = ExplicitFlag[[]int64, SliceParser[int64, UnixNanoParser[int64]]] + type UnixTimestamp = ExplicitFlag[int64, UnixTimestampParser[int64]] + type UnixTimestampParser struct + func (UnixTimestampParser[T]) ParseValue(opts *ParseOptions, arg string, out *T) (err error) + type UnixTimestampSlice = ExplicitFlag[[]int64, SliceParser[int64, UnixTimestampParser[int64]]] + type ValueParser interface + ParseValue func(opts *ParseOptions, arg string, out *T) error