Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArgsParser ¶
type ArgsParser interface { // ParseArgs parses the specified command line arguments into a parse context. ParseArgs(args []string) (*kingpin.ParseContext, error) }
ArgsParser parses command line arguments.
type ArgsParserFunc ¶
ArgsParserFunc is a functional wrapper for ArgsParser to enable ordinary functions as ArgsParsers.
func (ArgsParserFunc) ParseArgs ¶
func (r ArgsParserFunc) ParseArgs(args []string) (*kingpin.ParseContext, error)
ParseArgs parses the specified command line arguments into a parse context.
type CommandArgs ¶
type CommandArgs struct { // Parser is used to parse provided command-line. Parser ArgsParser // FlagsToAdd is a list of additional flags to add to resulting command. FlagsToAdd []Flag // FlagsToReplace is a list of flags to replace in the command. // A flag is only replaced if it has been provided. FlagsToReplace []Flag // FlagsToRemove is a list of flags to omit from the resulting command. FlagsToRemove []string }
CommandArgs manipulates command-line arguments.
func (*CommandArgs) Update ¶
func (r *CommandArgs) Update(command []string) (args []string, err error)
Update returns new command line for the provided command taking into account flags that need to be added or removed as configured. Positional arguments are moved to the end.
If a flag needs to be replaced (possibly to update the value), it needs to be placed into both FlagsToAdd and FlagsToRemove.
The resulting command line adheres to command line format accepted by systemd. See https://www.freedesktop.org/software/systemd/man/systemd.service.html#Command%20lines for details