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 ¶
- func MaskSecrets(argv []string) []string
- 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) HasOptionAndAnyValue(s string) bool
- func (t *T) HasOptionAndMatchingValue(s, v string) bool
- func (t *T) Set(args []string)
- func (t T) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaskSecrets ¶
MaskSecrets returns a copy of argv with the values of the secretFlags masked, as given in the "--flag value" or the "--flag=value" form.
An --env value keeps the name of the variable it sets, as NAME=xxx: which variable an action got is worth reading, its value is not.
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) HasOptionAndAnyValue ¶
HasOptionAndAnyValue returns true if any of the elements is matching s with any value
func (*T) HasOptionAndMatchingValue ¶
HasOptionAndMatchingValue returns true if any of the elements is matching s and the following element is matching the v regular expression.