Documentation
¶
Overview ¶
Package cli provides a minimal framework for creating and organizing command line Go applications. cli is designed to be easy to understand and write, the most simple cli application can be written as follows:
func main() {
(&cli.App{}).Run(os.Args)
}
Of course this application does not do much, so let's make this an actual application:
func main() {
app := &cli.App{
Name: "greet",
Usage: "say a greeting",
Action: func(c *cli.Context) error {
fmt.Println("Greetings")
return nil
},
}
app.Run(os.Args)
}
Index ¶
- Variables
- func DefaultAppComplete(c *Context)
- func DefaultCompleteWithFlags(cmd *Command) func(c *Context)
- func HandleAction(action any, context *Context) (err error)
- func HandleExitCoder(err error)
- func ShowAppHelp(c *Context) error
- func ShowAppHelpAndExit(c *Context, exitCode int)
- func ShowCommandCompletions(ctx *Context, command string)
- func ShowCommandHelp(ctx *Context, command string) error
- func ShowCommandHelpAndExit(c *Context, command string, code int)
- func ShowCompletions(c *Context)
- func ShowSubcommandHelp(c *Context) error
- func ShowVersion(c *Context)
- type ActionFunc
- type AfterFunc
- type App
- func (a *App) Command(name string) *Command
- func (a *App) Run(arguments []string) (err error)
- func (a *App) RunAndExitOnError()deprecated
- func (a *App) RunAsSubcommand(ctx *Context) (err error)
- func (a *App) RunContext(ctx context.Context, arguments []string) (err error)
- func (a *App) Setup()
- func (a *App) ToFishCompletion() (string, error)
- func (a *App) VisibleCategories() []CommandCategory
- func (a *App) VisibleCommands() []*Command
- func (a *App) VisibleFlags() []Flag
- type Args
- type Author
- type BashCompleteFunc
- type BeforeFunc
- type BoolFlag
- func (f *BoolFlag) Apply(set *flag.FlagSet) error
- func (f *BoolFlag) GetUsage() string
- func (f *BoolFlag) GetValue() string
- func (f *BoolFlag) IsRequired() bool
- func (f *BoolFlag) IsSet() bool
- func (f *BoolFlag) Names() []string
- func (f *BoolFlag) String() string
- func (f *BoolFlag) TakesValue() bool
- type Command
- type CommandCategories
- type CommandCategory
- type CommandNotFoundFunc
- type Commands
- type CommandsByName
- type Context
- func (c *Context) Args() Args
- func (c *Context) Bool(name string) bool
- func (c *Context) Duration(name string) time.Duration
- func (c *Context) FlagNames() []string
- func (c *Context) Int(name string) int
- func (c *Context) IsSet(name string) bool
- func (c *Context) Lineage() []*Context
- func (c *Context) LocalFlagNames() []string
- func (c *Context) NArg() int
- func (c *Context) NumFlags() int
- func (c *Context) Set(name, value string) error
- func (c *Context) String(name string) string
- func (c *Context) StringSlice(name string) []string
- func (c *Context) Value(name string) any
- type DocGenerationFlag
- type DurationFlag
- func (f *DurationFlag) Apply(set *flag.FlagSet) error
- func (f *DurationFlag) GetUsage() string
- func (f *DurationFlag) GetValue() string
- func (f *DurationFlag) IsRequired() bool
- func (f *DurationFlag) IsSet() bool
- func (f *DurationFlag) Names() []string
- func (f *DurationFlag) String() string
- func (f *DurationFlag) TakesValue() bool
- type ErrorFormatter
- type ExitCoder
- type ExitErrHandlerFunc
- type Flag
- type FlagEnvHintFunc
- type FlagFileHintFunc
- type FlagNamePrefixFunc
- type FlagStringFunc
- type FlagsByName
- type IntFlag
- type MultiError
- type OnUsageErrorFunc
- type RequiredFlag
- type Serializer
- type StringFlag
- func (f *StringFlag) Apply(set *flag.FlagSet) error
- func (f *StringFlag) GetUsage() string
- func (f *StringFlag) GetValue() string
- func (f *StringFlag) IsRequired() bool
- func (f *StringFlag) IsSet() bool
- func (f *StringFlag) Names() []string
- func (f *StringFlag) String() string
- func (f *StringFlag) TakesValue() bool
- type StringSlice
- type StringSliceFlag
- func (f *StringSliceFlag) Apply(set *flag.FlagSet) error
- func (f *StringSliceFlag) GetUsage() string
- func (f *StringSliceFlag) GetValue() string
- func (f *StringSliceFlag) IsRequired() bool
- func (f *StringSliceFlag) IsSet() bool
- func (f *StringSliceFlag) Names() []string
- func (f *StringSliceFlag) String() string
- func (f *StringSliceFlag) TakesValue() bool
Constants ¶
This section is empty.
Variables ¶
var ( AppHelpTemplate = "app" CommandHelpTemplate = "command" SubcommandHelpTemplate = "subcommand" )
These layout identifiers preserve the help customization fields used by the parser while keeping croc's renderer independent of text/template.
var ErrWriter io.Writer = os.Stderr
ErrWriter is used to write errors to the user. This can be anything implementing the io.Writer interface and defaults to os.Stderr.
var HelpPrinter helpPrinter = printHelp
HelpPrinter is a function that writes the help output. If not set explicitly, this calls HelpPrinterCustom using only the default template functions.
If custom logic for printing help is required, this function can be overridden. If the ExtraInfo field is defined on an App, this function should not be modified, as HelpPrinterCustom will be used directly in order to capture the extra information.
var HelpPrinterCustom helpPrinterCustom = printHelpCustom
HelpPrinterCustom is a function that writes the help output. It is used as the default implementation of HelpPrinter, and may be called directly if the ExtraInfo field is set on an App.
var OsExiter = os.Exit
OsExiter is the function used when the app exits. If not set defaults to os.Exit.
var VersionPrinter = printVersion
VersionPrinter prints the version for the App
Functions ¶
func DefaultAppComplete ¶
func DefaultAppComplete(c *Context)
DefaultAppComplete prints the list of subcommands as the default app completion method
func HandleAction ¶
HandleAction attempts to figure out which Action signature was used. If it's an ActionFunc or a func with the legacy signature for Action, the func is run!
func HandleExitCoder ¶
func HandleExitCoder(err error)
HandleExitCoder handles errors implementing ExitCoder by printing their message and calling OsExiter with the given exit code.
If the given error instead implements MultiError, each error will be checked for the ExitCoder interface, and OsExiter will be called with the last exit code found, or exit code 1 if no ExitCoder is found.
This function is the default error-handling behavior for an App.
func ShowAppHelp ¶
ShowAppHelp is an action that displays the help.
func ShowAppHelpAndExit ¶
ShowAppHelpAndExit - Prints the list of subcommands for the app and exits with exit code.
func ShowCommandCompletions ¶
ShowCommandCompletions prints the custom completions for a given command
func ShowCommandHelp ¶
ShowCommandHelp prints help for the given command
func ShowCommandHelpAndExit ¶
ShowCommandHelpAndExit - exits with code after showing help
func ShowCompletions ¶
func ShowCompletions(c *Context)
ShowCompletions prints the lists of commands within a given context
func ShowSubcommandHelp ¶
ShowSubcommandHelp prints help for the given subcommand
Types ¶
type ActionFunc ¶
ActionFunc is the action to execute when no subcommands are specified
type AfterFunc ¶
AfterFunc is an action to execute after any subcommands are run, but after the subcommand has finished it is run even if Action() panics
type App ¶
type App struct {
// The name of the program. Defaults to path.Base(os.Args[0])
Name string
// Full name of command for help, defaults to Name
HelpName string
// Description of the program.
Usage string
// Text to override the USAGE section of help
UsageText string
// Description of the program argument format.
ArgsUsage string
// Version of the program
Version string
// Description of the program
Description string
// List of commands to execute
Commands []*Command
// List of flags to parse
Flags []Flag
// Boolean to enable bash completion commands
EnableBashCompletion bool
// Boolean to hide built-in help command and help flag
HideHelp bool
// Boolean to hide built-in help command but keep help flag.
// Ignored if HideHelp is true.
HideHelpCommand bool
// Boolean to hide built-in version flag and the VERSION section of help
HideVersion bool
// An action to execute when the shell completion flag is set
BashComplete BashCompleteFunc
// An action to execute before any subcommands are run, but after the context is ready
// If a non-nil error is returned, no subcommands are run
Before BeforeFunc
// An action to execute after any subcommands are run, but after the subcommand has finished
// It is run even if Action() panics
After AfterFunc
// The action to execute when no subcommands are specified
Action ActionFunc
// Execute this function if the proper command cannot be found
CommandNotFound CommandNotFoundFunc
// Execute this function if an usage error occurs
OnUsageError OnUsageErrorFunc
// Compilation date
Compiled time.Time
// List of all authors who contributed
Authors []*Author
// Copyright of the binary if any
Copyright string
// Writer writer to write output to
Writer io.Writer
// ErrWriter writes error output
ErrWriter io.Writer
// ExitErrHandler processes any error encountered while running an App before
// it is returned to the caller. If no function is provided, HandleExitCoder
// is used as the default behavior.
ExitErrHandler ExitErrHandlerFunc
// Other custom info
Metadata map[string]any
// Carries a function which returns app specific info.
ExtraInfo func() map[string]string
// CustomAppHelpTemplate the text template for app help topic.
// cli.go uses text/template to render templates. You can
// render custom help text by setting this variable.
CustomAppHelpTemplate string
// Boolean to enable short-option handling so user can combine several
// single-character bool arguments into one
// i.e. foobar -o -v -> foobar -ov
UseShortOptionHandling bool
// contains filtered or unexported fields
}
App is the main structure of a cli application. It is recommended that an app be created with the cli.NewApp() function
func NewApp ¶
func NewApp() *App
NewApp creates a new cli Application with some reasonable defaults for Name, Usage, Version and Action.
func (*App) Command ¶
Command returns the named command on App. Returns nil if the command does not exist
func (*App) Run ¶
Run is the entry point to the cli app. Parses the arguments slice and routes to the proper flag/args combination
func (*App) RunAndExitOnError
deprecated
func (a *App) RunAndExitOnError()
RunAndExitOnError calls .Run() and exits non-zero if an error was returned
Deprecated: instead you should return an error that fulfills cli.ExitCoder to cli.App.Run. This will cause the application to exit with the given error code in the cli.ExitCoder
func (*App) RunAsSubcommand ¶
RunAsSubcommand invokes the subcommand given the context, parses ctx.Args() to generate command-specific flags
func (*App) RunContext ¶
RunContext is like Run except it takes a Context that will be passed to its commands and sub-commands. Through this, you can propagate timeouts and cancellation requests
func (*App) Setup ¶
func (a *App) Setup()
Setup runs initialization code to ensure all data structures are ready for `Run` or inspection prior to `Run`. It is internally called by `Run`, but will return early if setup has already happened.
func (*App) ToFishCompletion ¶
ToFishCompletion creates a fish completion string for the `*App` The function errors if either parsing or writing of the string fails.
func (*App) VisibleCategories ¶
func (a *App) VisibleCategories() []CommandCategory
VisibleCategories returns a slice of categories and commands that are Hidden=false
func (*App) VisibleCommands ¶
VisibleCommands returns a slice of the Commands with Hidden=false
func (*App) VisibleFlags ¶
VisibleFlags returns a slice of the Flags with Hidden=false
type Args ¶
type Args interface {
// Get returns the nth argument, or else a blank string
Get(n int) string
// First returns the first argument, or else a blank string
First() string
// Tail returns the rest of the arguments (not the first one)
// or else an empty string slice
Tail() []string
// Len returns the length of the wrapped slice
Len() int
// Present checks if there are any arguments present
Present() bool
// Slice returns a copy of the internal slice
Slice() []string
}
type BashCompleteFunc ¶
type BashCompleteFunc func(*Context)
BashCompleteFunc is an action to execute when the shell completion flag is set
type BeforeFunc ¶
BeforeFunc is an action to execute before any subcommands are run, but after the context is ready if a non-nil error is returned, no subcommands are run
type BoolFlag ¶
type BoolFlag struct {
Name string
Aliases []string
Usage string
EnvVars []string
FilePath string
Required bool
Hidden bool
Value bool
DefaultText string
Destination *bool
HasBeenSet bool
}
BoolFlag is a flag with type bool
func (*BoolFlag) GetValue ¶
GetValue returns the flags value as string representation and an empty string if the flag takes no value at all.
func (*BoolFlag) IsRequired ¶
IsRequired returns whether or not the flag is required
func (*BoolFlag) String ¶
String returns a readable representation of this value (for usage defaults)
func (*BoolFlag) TakesValue ¶
TakesValue returns true of the flag takes a value, otherwise false
type Command ¶
type Command struct {
// The name of the command
Name string
// A list of aliases for the command
Aliases []string
// A short description of the usage of this command
Usage string
// Custom text to show on USAGE section of help
UsageText string
// A longer explanation of how the command works
Description string
// A short description of the arguments of this command
ArgsUsage string
// The category the command is part of
Category string
// The function to call when checking for bash command completions
BashComplete BashCompleteFunc
// An action to execute before any sub-subcommands are run, but after the context is ready
// If a non-nil error is returned, no sub-subcommands are run
Before BeforeFunc
// An action to execute after any subcommands are run, but after the subcommand has finished
// It is run even if Action() panics
After AfterFunc
// The function to call when this command is invoked
Action ActionFunc
// Execute this function if a usage error occurs.
OnUsageError OnUsageErrorFunc
// List of child commands
Subcommands []*Command
// List of flags to parse
Flags []Flag
// Treat all flags as normal arguments if true
SkipFlagParsing bool
// Boolean to hide built-in help command and help flag
HideHelp bool
// Boolean to hide built-in help command but keep help flag
// Ignored if HideHelp is true.
HideHelpCommand bool
// Boolean to hide this command from help or completion
Hidden bool
// Boolean to enable short-option handling so user can combine several
// single-character bool arguments into one
// i.e. foobar -o -v -> foobar -ov
UseShortOptionHandling bool
// Full name of command for help, defaults to full command name, including parent commands.
HelpName string
// CustomHelpTemplate the text template for the command help topic.
// cli.go uses text/template to render templates. You can
// render custom help text by setting this variable.
CustomHelpTemplate string
// contains filtered or unexported fields
}
Command is a subcommand for a cli.App.
func (*Command) FullName ¶
FullName returns the full name of the command. For subcommands this ensures that parent commands are part of the command path
func (*Command) Run ¶
Run invokes the command given the context, parses ctx.Args() to generate command-specific flags
func (*Command) VisibleFlags ¶
VisibleFlags returns a slice of the Flags with Hidden=false
type CommandCategories ¶
type CommandCategories interface {
// AddCommand adds a command to a category, creating a new category if necessary.
AddCommand(category string, command *Command)
// categories returns a copy of the category slice
Categories() []CommandCategory
}
CommandCategories interface allows for category manipulation
type CommandCategory ¶
type CommandCategory interface {
// Name returns the category name string
Name() string
// VisibleCommands returns a slice of the Commands with Hidden=false
VisibleCommands() []*Command
}
CommandCategory is a category containing commands.
type CommandNotFoundFunc ¶
CommandNotFoundFunc is executed if the proper command cannot be found
type CommandsByName ¶
type CommandsByName []*Command
func (CommandsByName) Len ¶
func (c CommandsByName) Len() int
func (CommandsByName) Less ¶
func (c CommandsByName) Less(i, j int) bool
func (CommandsByName) Swap ¶
func (c CommandsByName) Swap(i, j int)
type Context ¶
type Context struct {
context.Context
App *App
Command *Command
// contains filtered or unexported fields
}
Context is a type that is passed through to each Handler action in a cli application. Context can be used to retrieve context-specific args and parsed command-line options.
func NewContext ¶
NewContext creates a new context. For use in when invoking an App or Command action.
func (*Context) Duration ¶
Duration looks up the value of a local DurationFlag, returns 0 if not found
func (*Context) FlagNames ¶
FlagNames returns a slice of flag names used by the this context and all of its parent contexts.
func (*Context) Lineage ¶
Lineage returns *this* context and all of its ancestor contexts in order from child to parent
func (*Context) LocalFlagNames ¶
LocalFlagNames returns a slice of flag names used in this context.
func (*Context) StringSlice ¶
StringSlice looks up the value of a local StringSliceFlag, returns nil if not found
type DocGenerationFlag ¶
type DocGenerationFlag interface {
Flag
// TakesValue returns true if the flag takes a value, otherwise false
TakesValue() bool
// GetUsage returns the usage string for the flag
GetUsage() string
// GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all.
GetValue() string
}
DocGenerationFlag is an interface that allows documentation generation for the flag
type DurationFlag ¶
type DurationFlag struct {
Name string
Aliases []string
Usage string
EnvVars []string
FilePath string
Required bool
Hidden bool
Value time.Duration
DefaultText string
Destination *time.Duration
HasBeenSet bool
}
DurationFlag is a flag with type time.Duration (see https://golang.org/pkg/time/#ParseDuration)
func (*DurationFlag) Apply ¶
func (f *DurationFlag) Apply(set *flag.FlagSet) error
Apply populates the flag given the flag set and environment
func (*DurationFlag) GetUsage ¶
func (f *DurationFlag) GetUsage() string
GetUsage returns the usage string for the flag
func (*DurationFlag) GetValue ¶
func (f *DurationFlag) GetValue() string
GetValue returns the flags value as string representation and an empty string if the flag takes no value at all.
func (*DurationFlag) IsRequired ¶
func (f *DurationFlag) IsRequired() bool
IsRequired returns whether or not the flag is required
func (*DurationFlag) IsSet ¶
func (f *DurationFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file
func (*DurationFlag) Names ¶
func (f *DurationFlag) Names() []string
Names returns the names of the flag
func (*DurationFlag) String ¶
func (f *DurationFlag) String() string
String returns a readable representation of this value (for usage defaults)
func (*DurationFlag) TakesValue ¶
func (f *DurationFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false
type ErrorFormatter ¶
ErrorFormatter is the interface that will suitably format the error output
type ExitCoder ¶
ExitCoder is the interface checked by `App` and `Command` for a custom exit code
func Exit ¶
Exit wraps a message and exit code into an error, which by default is handled with a call to os.Exit during default error handling.
This is the simplest way to trigger a non-zero exit code for an App without having to call os.Exit manually. During testing, this behavior can be avoided by overriding the ExitErrHandler function on an App or the package-global OsExiter function.
func NewExitError
deprecated
type ExitErrHandlerFunc ¶
ExitErrHandlerFunc is executed if provided in order to handle exitError values returned by Actions and Before/After functions.
type Flag ¶
type Flag interface {
fmt.Stringer
// Apply Flag settings to the given flag set
Apply(*flag.FlagSet) error
Names() []string
IsSet() bool
}
Flag is a common interface related to parsing flags in cli. For more advanced flag parsing techniques, it is recommended that this interface be implemented.
BashCompletionFlag enables bash-completion for all commands and subcommands
HelpFlag prints the help for all commands and subcommands. Set to nil to disable the flag. The subcommand will still be added unless HideHelp or HideHelpCommand is set to true.
type FlagEnvHintFunc ¶
FlagEnvHintFunc is used by the default FlagStringFunc to annotate flag help with the environment variable details.
var FlagEnvHinter FlagEnvHintFunc = withEnvHint
FlagEnvHinter annotates flag help message with the environment variable details. This is used by the default FlagStringer.
type FlagFileHintFunc ¶
FlagFileHintFunc is used by the default FlagStringFunc to annotate flag help with the file path details.
var FlagFileHinter FlagFileHintFunc = withFileHint
FlagFileHinter annotates flag help message with the environment variable details. This is used by the default FlagStringer.
type FlagNamePrefixFunc ¶
FlagNamePrefixFunc is used by the default FlagStringFunc to create prefix text for a flag's full name.
var FlagNamePrefixer FlagNamePrefixFunc = prefixedNames
FlagNamePrefixer converts a full flag name and its placeholder into the help message flag prefix. This is used by the default FlagStringer.
type FlagStringFunc ¶
FlagStringFunc is used by the help generation to display a flag, which is expected to be a single line.
var FlagStringer FlagStringFunc = stringifyFlag
FlagStringer converts a flag definition to a string. This is used by help to display a flag.
type FlagsByName ¶
type FlagsByName []Flag
FlagsByName is a slice of Flag.
func (FlagsByName) Len ¶
func (f FlagsByName) Len() int
func (FlagsByName) Less ¶
func (f FlagsByName) Less(i, j int) bool
func (FlagsByName) Swap ¶
func (f FlagsByName) Swap(i, j int)
type IntFlag ¶
type IntFlag struct {
Name string
Aliases []string
Usage string
EnvVars []string
FilePath string
Required bool
Hidden bool
Value int
DefaultText string
Destination *int
HasBeenSet bool
}
IntFlag is a flag with type int
func (*IntFlag) GetValue ¶
GetValue returns the flags value as string representation and an empty string if the flag takes no value at all.
func (*IntFlag) IsRequired ¶
IsRequired returns whether or not the flag is required
func (*IntFlag) String ¶
String returns a readable representation of this value (for usage defaults)
func (*IntFlag) TakesValue ¶
TakesValue returns true of the flag takes a value, otherwise false
type MultiError ¶
MultiError is an error that wraps multiple errors.
type OnUsageErrorFunc ¶
OnUsageErrorFunc is executed if an usage error occurs. This is useful for displaying customized usage error messages. This function is able to replace the original error messages. If this function is not set, the "Incorrect usage" is displayed and the execution is interrupted.
type RequiredFlag ¶
RequiredFlag is an interface that allows us to mark flags as required it allows flags required flags to be backwards compatible with the Flag interface
type Serializer ¶
type Serializer interface {
Serialize() string
}
Serializer is used to circumvent the limitations of flag.FlagSet.Set
type StringFlag ¶
type StringFlag struct {
Name string
Aliases []string
Usage string
EnvVars []string
FilePath string
Required bool
Hidden bool
TakesFile bool
Value string
DefaultText string
Destination *string
HasBeenSet bool
}
StringFlag is a flag with type string
func (*StringFlag) Apply ¶
func (f *StringFlag) Apply(set *flag.FlagSet) error
Apply populates the flag given the flag set and environment
func (*StringFlag) GetUsage ¶
func (f *StringFlag) GetUsage() string
GetUsage returns the usage string for the flag
func (*StringFlag) GetValue ¶
func (f *StringFlag) GetValue() string
GetValue returns the flags value as string representation and an empty string if the flag takes no value at all.
func (*StringFlag) IsRequired ¶
func (f *StringFlag) IsRequired() bool
IsRequired returns whether or not the flag is required
func (*StringFlag) IsSet ¶
func (f *StringFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file
func (*StringFlag) Names ¶
func (f *StringFlag) Names() []string
Names returns the names of the flag
func (*StringFlag) String ¶
func (f *StringFlag) String() string
String returns a readable representation of this value (for usage defaults)
func (*StringFlag) TakesValue ¶
func (f *StringFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false
type StringSlice ¶
type StringSlice struct {
// contains filtered or unexported fields
}
StringSlice wraps a []string to satisfy flag.Value
func NewStringSlice ¶
func NewStringSlice(defaults ...string) *StringSlice
NewStringSlice creates a *StringSlice with default values
func (*StringSlice) Get ¶
func (s *StringSlice) Get() any
Get returns the slice of strings set by this flag
func (*StringSlice) Serialize ¶
func (s *StringSlice) Serialize() string
Serialize allows StringSlice to fulfill Serializer
func (*StringSlice) Set ¶
func (s *StringSlice) Set(value string) error
Set appends the string value to the list of values
func (*StringSlice) String ¶
func (s *StringSlice) String() string
String returns a readable representation of this value (for usage defaults)
func (*StringSlice) Value ¶
func (s *StringSlice) Value() []string
Value returns the slice of strings set by this flag
type StringSliceFlag ¶
type StringSliceFlag struct {
Name string
Aliases []string
Usage string
EnvVars []string
FilePath string
Required bool
Hidden bool
TakesFile bool
Value *StringSlice
DefaultText string
HasBeenSet bool
Destination *StringSlice
}
StringSliceFlag is a flag with type *StringSlice
func (*StringSliceFlag) Apply ¶
func (f *StringSliceFlag) Apply(set *flag.FlagSet) error
Apply populates the flag given the flag set and environment
func (*StringSliceFlag) GetUsage ¶
func (f *StringSliceFlag) GetUsage() string
GetUsage returns the usage string for the flag
func (*StringSliceFlag) GetValue ¶
func (f *StringSliceFlag) GetValue() string
GetValue returns the flags value as string representation and an empty string if the flag takes no value at all.
func (*StringSliceFlag) IsRequired ¶
func (f *StringSliceFlag) IsRequired() bool
IsRequired returns whether or not the flag is required
func (*StringSliceFlag) IsSet ¶
func (f *StringSliceFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file
func (*StringSliceFlag) Names ¶
func (f *StringSliceFlag) Names() []string
Names returns the names of the flag
func (*StringSliceFlag) String ¶
func (f *StringSliceFlag) String() string
String returns a readable representation of this value (for usage defaults)
func (*StringSliceFlag) TakesValue ¶
func (f *StringSliceFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false