Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Argument ¶
type Argument struct {
// contains filtered or unexported fields
}
Argument holds parsing metadata and the optional user supplied value.
func (*Argument) Get ¶
Get returns the current value (default or user supplied).
type Parser ¶
type Parser struct {
// Args stores registered arguments and values discovered during parsing.
Args map[string]*Argument
// contains filtered or unexported fields
}
Parser parses alternating key/value CLI arguments with regex validation.
func NewParser ¶
NewParser compiles the provided regex and returns an initialized parser.
func (*Parser) Get ¶
Get locates an argument by key.
func (*Parser) GetValue ¶
GetValue returns the string value for a registered argument.
func (*Parser) Parse ¶
Parse walks the args slice and assigns discovered values to registered keys. When strict is false, unknown keys are added on the fly.
Source Files
¶
- Argument.go
- Parser.go
Click to show internal directories.
Click to hide internal directories.