Documentation
¶
Overview ¶
Package cli provides command-line interface utilities
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearEmptyCategories ¶
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
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 ShowUsageAndExit ¶ added in v0.3.0
ShowUsageAndExit calls ShowUsage and then os.Exit with the `exitCode` given
func ShowUsageOptions ¶ added in v0.3.0
ShowUsageOptions is like ShowUsage but includes a listing of all option names and aliases
func ShowUsageOptionsAndExit ¶ added in v0.3.0
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
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