Documentation ¶
Index ¶
- Constants
- type Args
- func (args Args) DeleteFlag(flagName string) (res Args, deleted bool)
- func (args Args) IterateEntries(yield func(entry Entry) (getNext bool))
- func (args Args) IterateTokens(yield func(info Token) bool)
- func (args Args) LookupFlag(flagName string) (res FlagEntry, has bool)
- func (args Args) MapEntries(mapper func(Entry) Entry) Args
- func (args Args) MapFlags(mapper func(flag FlagEntry) (mapped Entry)) Args
- func (args Args) StripUnknownFlags(ignoredFlagsWithKnownType stdutil.FormalTagNames) (res, stripped Args)
- func (args Args) UpsertFlag(insert FlagEntry, update func(old FlagEntry) (updated FlagEntry)) Args
- func (args Args) WithAmbiguousAsBool(ambiguousAsBool bool) Args
- func (args Args) WithFlagSet(flagSets ...*flag.FlagSet) Args
- func (args Args) WithKnownFlags(knownFlags stdutil.FormalTagNames) Args
- func (args Args) WithoutKnownFlags(knownFlagsToRemove stdutil.FormalTagNames) Args
- type Entry
- type EntryKind
- type FlagEntry
- func (f FlagEntry) Equals(other FlagEntry) bool
- func (f FlagEntry) IsBool() bool
- func (f FlagEntry) IsDoubleDashed() bool
- func (f FlagEntry) IsInline() bool
- func (f FlagEntry) Kind() EntryKind
- func (f FlagEntry) Name() string
- func (f FlagEntry) String() string
- func (f FlagEntry) TokenStrings() []string
- func (f FlagEntry) TokensCount() int
- func (f FlagEntry) Value() string
- func (f FlagEntry) WithDoubleDashes(isDoubleDashed bool) FlagEntry
- func (f FlagEntry) WithInline(isInline bool) FlagEntry
- func (f FlagEntry) WithName(name string) FlagEntry
- func (f FlagEntry) WithNoValue() FlagEntry
- func (f FlagEntry) WithValue(value string) FlagEntry
- type Role
- type TerminatorEntry
- type Token
- type UnnamedArgsEntry
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Args ¶
type Args struct { Args []string // contains filtered or unexported fields }
func (Args) IterateEntries ¶
func (Args) IterateTokens ¶
func (Args) StripUnknownFlags ¶
func (args Args) StripUnknownFlags( ignoredFlagsWithKnownType stdutil.FormalTagNames, ) (res, stripped Args)
func (Args) UpsertFlag ¶
func (Args) WithAmbiguousAsBool ¶
func (Args) WithKnownFlags ¶
func (args Args) WithKnownFlags(knownFlags stdutil.FormalTagNames) Args
func (Args) WithoutKnownFlags ¶
func (args Args) WithoutKnownFlags(knownFlagsToRemove stdutil.FormalTagNames) Args
type Entry ¶
func NewTerminatorEntry ¶
func NewTerminatorEntry() Entry
type FlagEntry ¶
type FlagEntry struct {
// contains filtered or unexported fields
}
func NewBoolFlagEntry ¶
func NewFlagEntry ¶
func (FlagEntry) IsDoubleDashed ¶
func (FlagEntry) TokenStrings ¶
func (FlagEntry) TokensCount ¶
func (FlagEntry) WithDoubleDashes ¶
func (FlagEntry) WithInline ¶
WithInline makes the flag inline or not inline If it was a bool flag and `isInline = false`, it becomes a non-bool flag with string value. In this case, if bool flag didn't have inline value, it will have empty string non-inline value If it was a bool flag with no value and `isInline = true`, explicit value "true" will be used
func (FlagEntry) WithNoValue ¶
WithNoValue makes the flag a bool flag with no value (equals true)
type TerminatorEntry ¶
type TerminatorEntry struct{}
func (TerminatorEntry) Kind ¶
func (tt TerminatorEntry) Kind() EntryKind
func (TerminatorEntry) String ¶
func (tt TerminatorEntry) String() string
func (TerminatorEntry) TokenStrings ¶
func (tt TerminatorEntry) TokenStrings() []string
func (TerminatorEntry) TokensCount ¶
func (tt TerminatorEntry) TokensCount() int
type Token ¶
type Token struct { Arg string FlagName string FlagValue string // Role is sum of Role constants. Possible values: // RoleFlag | RoleKnown | RoleInline // contains FlagValue // RoleFlag | RoleKnown | RoleBoolFlag // no FlagValue, implicit `true` // RoleFlag | RoleKnown | RoleInline | RoleBoolFlag // explicit bool string FlagValue // RoleFlag | RoleKnown // will be followed by value // RoleFlag | RoleInline // unknown, contains FlagValue // RoleFlag | RoleBoolFlag // unknown, located at the end, no FlagValue // RoleFlag // unknown, it's ambiguous whether it's bool flag or flag name // // On receiving it, yield function should decide how to treat it // RoleUnnamed // RoleFlagValue // goes next after non-inline flag // RoleTerminator Role Role }
type UnnamedArgsEntry ¶
type UnnamedArgsEntry []string
func (UnnamedArgsEntry) Kind ¶
func (ua UnnamedArgsEntry) Kind() EntryKind
func (UnnamedArgsEntry) String ¶
func (ua UnnamedArgsEntry) String() string
func (UnnamedArgsEntry) TokenStrings ¶
func (ua UnnamedArgsEntry) TokenStrings() []string
func (UnnamedArgsEntry) TokensCount ¶
func (ua UnnamedArgsEntry) TokensCount() int
Click to show internal directories.
Click to hide internal directories.