args

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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