args

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexOf

func IndexOf(slice []string, val string) int

TODO "golang.org/x/exp/slices"

func MovePostFixCommands

func MovePostFixCommands(args []string, commands []*cli.Command) []string

Places the command being called at the beginning of the args slice for parsing

func MovePostfixOptions

func MovePostfixOptions(args []string, validFlags []ParsedFlag) []string

Used to move non option(-) arguments to the end of the command, this way positional arguments do not have to go before the optional arguments

Arguments do not behave how a unix cli would expect them to:

func ParseArguments

func ParseArguments(globalFlags []cli.Flag, commands []*cli.Command, args ...string) []string

Types

type ParsedFlag

type ParsedFlag struct {
	Options    []string
	IsBoolFlag bool
}

func ParseFlag

func ParseFlag(flag cli.Flag) ParsedFlag

func ParseFlags

func ParseFlags(flags []cli.Flag) []ParsedFlag

Gets a string slice from cli.flags so that they can be moved to their required position from anywhere. This way `tau new --e` and `tau --e new` are both valid commands.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL