Documentation ¶
Overview ¶
Package cmdl provides functions to parse command line arguments.
Index ¶
- type AssignmentOperator
- type CommandLine
- type Parameter
- func (param *Parameter) Add(key, value string)
- func (param *Parameter) Available() bool
- func (param *Parameter) Count() int
- func (param *Parameter) Keys() []string
- func (param *Parameter) Parse(keys ...string) *Parameter
- func (param *Parameter) ParsePairs(asgOps *AssignmentOperator, keys ...string) *Parameter
- func (param *Parameter) Values() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssignmentOperator ¶
type AssignmentOperator struct {
// contains filtered or unexported fields
}
AssignmentOperator represents the operator between key and value in argument.
func NewAsgOp ¶
func NewAsgOp(blankAllowed, emptyAllowed bool, ops ...string) *AssignmentOperator
NewAsgOp creates and returns a new instance of AssignmentOperator.
func (*AssignmentOperator) MatchingOp ¶
func (asgOps *AssignmentOperator) MatchingOp(str string) (bool, string)
MatchingOp returns true and matching operator, if str starts with assignment operator.
type CommandLine ¶
type CommandLine struct {
// contains filtered or unexported fields
}
CommandLine holds command line arguments.
func NewFrom ¶
func NewFrom(args []string) *CommandLine
NewFrom creates and returns a new instance of CommandLine.
func (*CommandLine) Args ¶
func (cl *CommandLine) Args() []string
Args returns command line arguments.
func (*CommandLine) NewParam ¶
func (cl *CommandLine) NewParam() *Parameter
NewParam creates and returns a new instance of Parameter.
func (*CommandLine) UnparsedArgs ¶
func (cl *CommandLine) UnparsedArgs() []string
UnparsedArgs returns unparsed arguments.
type Parameter ¶
type Parameter struct {
// contains filtered or unexported fields
}
Parameter represents a parsed argument from command line.
func (*Parameter) ParsePairs ¶
func (param *Parameter) ParsePairs(asgOps *AssignmentOperator, keys ...string) *Parameter
ParsePairs searches for keys in command line.