Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsShortcut ¶
IsShortcut is a helper to determine whether a given matcher is a Shortcut (always matches)
Types ¶
type Matcher ¶
type Matcher interface { /* Match examines the provided args and: - likes it, fills the parse context and returns true and the remaining args it didn't consume - doesn't like it, returns false and the remaining args it didn't consume */ Match(args []string, c *ParseContext) (bool, []string) // Priority used to sort matchers. the lower the returned number, the higher the priority of the matcher Priority() int }
Matcher is used to parse and consume the args and populate the ParseContext
func NewOptions ¶
NewOptions create an Options matcher which can parse a group of options
func NewOptsEnd ¶
func NewOptsEnd() Matcher
NewOptsEnd returns the special matcher that matches the -- operator
func NewShortcut ¶
func NewShortcut() Matcher
NewShortcut create a special matcher that always matches and doesn't consume any input
type ParseContext ¶
type ParseContext struct { Args map[*container.Container][]string Opts map[*container.Container][]string ExcludedOpts map[*container.Container]struct{} RejectOptions bool }
ParseContext holds the state of the arguments parsing, i.e. the encountered options and arguments values, etc.
func NewParseContext ¶
func NewParseContext() ParseContext
NewParseContext create a new ParseContext
func (ParseContext) Merge ¶
func (pc ParseContext) Merge(o ParseContext)
Merge adds the values in the provided context in the current context
Source Files ¶
Click to show internal directories.
Click to hide internal directories.