Documentation ¶
Overview ¶
Package cli provides command-line interface utilities
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearEmptyCategories ¶
func ClearEmptyCategories(flags []cli.Flag)
ClearEmptyCategories sets all flag.Category strings to empty if the specific category does not have any visible flags
func ShowOptions ¶ added in v0.3.0
func ShowOptions(ctx *cli.Context)
ShowOptions prints each option (and it's aliases), one per line, to os.Stderr and with flags named "usage", "help", "version" and "verbose" separated and sorted after all other flags
func ShowUsage ¶ added in v0.3.0
func ShowUsage(ctx *cli.Context)
ShowUsage prints a very brief usage text line to os.Stderr
func ShowUsageAndExit ¶ added in v0.3.0
func ShowUsageAndExit(ctx *cli.Context, exitCode int)
ShowUsageAndExit calls ShowUsage and then os.Exit with the `exitCode` given
func ShowUsageOptions ¶ added in v0.3.0
func ShowUsageOptions(ctx *cli.Context)
ShowUsageOptions is like ShowUsage but includes a listing of all option names and aliases
func ShowUsageOptionsAndExit ¶ added in v0.3.0
func ShowUsageOptionsAndExit(ctx *cli.Context, exitCode int)
ShowUsageOptionsAndExit calls ShowUsageOptions and then os.Exit with the `exitCode` given
Types ¶
type BaseFlag ¶ added in v0.3.0
type BaseFlag struct { Name string Category string DefaultText string Usage string Required bool Hidden bool Aliases []string EnvVars []string // contains filtered or unexported fields }
BaseFlag is a type containing only the common variables for any given cli.Flag type
func DecodeBaseFlag ¶ added in v0.3.0
func DecodeBaseFlag(flag cli.Flag) (base *BaseFlag)
DecodeBaseFlag returns a BaseFlag representation of the given cli.Flag
func NewBaseFlag ¶ added in v0.3.0
func NewBaseFlag(name, category, defaultText, usage string, required, hidden bool, aliases, envVars []string, original cli.Flag) *BaseFlag
NewBaseFlag constructs a new BaseFlag instance
func (*BaseFlag) NameWithAliases ¶ added in v0.4.0
NameWithAliases returns the flag name and any aliases, with leading dashes
type FlagStringer ¶
type FlagStringer interface { // PruneEnvVars specifies if `[$ENV_VAR...]` text is removed PruneEnvVars(enable bool) FlagStringer // PruneDefaults specifies if `(default: ...)` text is removed PruneDefaults(enable bool) FlagStringer // PruneDefaultBools specifies if only boolean flag defaults are removed PruneDefaultBools(enable bool) FlagStringer // PruneRepeats specifies if slice flags have their repeated example removed PruneRepeats(enable bool) FlagStringer // DetailsOnNewLines specifies if defaults and env vars are places on new // lines instead of all in one line DetailsOnNewLines(enable bool) FlagStringer // Make produces the cli.FlagStringFunc Make() cli.FlagStringFunc }
FlagStringer is a buildable interface for constructing a pre-configured cli.FlagStringFunc instances
func NewFlagStringer ¶
func NewFlagStringer() FlagStringer
NewFlagStringer creates a new FlagStringer instance, ready to be configured and made into a cli.FlagStringFunc