Documentation ¶
Overview ¶
Package args parses a posix arguments string using shlex.Split() and proposes methods to drop options and option-values.
Example:
args, _ := Parse("-f -c /tmp/foo --comment foo --comment 'foo bar'") args.DropOption("-f") args.DropOptionAndAnyValue("-c") args.DropOptionAndAnyValue("--comment") args.Get()
Index ¶
- type T
- func (t *T) Append(s ...string)
- func (t *T) DropOption(s string)
- func (t *T) DropOptionAndAnyValue(s string)
- func (t *T) DropOptionAndExactValue(s, v string)
- func (t *T) DropOptionAndMatchingValue(s, v string)
- func (t T) Get() []string
- func (t *T) HasOption(s string) bool
- func (t *T) HasOptionAndMatchingValue(s, v string) bool
- func (t *T) Set(args []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type T ¶
type T struct {
// contains filtered or unexported fields
}
func (*T) DropOption ¶
DropOption removes from args the elements matching s. If multiple elements match, they are all removed.
func (*T) DropOptionAndAnyValue ¶
DropOptionAndAnyValue removes from args the elements matching s and the following element, considered the value of the option. If multiple elements match, they are all removed.
func (*T) DropOptionAndExactValue ¶
DropOptionAndExactValue removes from args the elements matching s and the following element exactly matching v.
func (*T) DropOptionAndMatchingValue ¶
DropOptionAndMatchingValue removes from args the elements matching s and the following element matching the v regular expression.
func (*T) HasOptionAndMatchingValue ¶
HasOptionAndMatchingValue returns true if any of the elements is matching s and the following element is matching the v regular expression.