Documentation ¶
Index ¶
- type Action
- type CmdConfig
- type CmdOption
- func WithAliases(aliases []string) CmdOption
- func WithArgsUsage(argsUsage string) CmdOption
- func WithCategory(category string) CmdOption
- func WithCustomHelpTemplate(customHelpTemplate string) CmdOption
- func WithDescription(description string) CmdOption
- func WithHelpName(helpName string) CmdOption
- func WithHidden(hidden bool) CmdOption
- func WithHideHelp(hideHelp bool) CmdOption
- func WithName(name string) CmdOption
- func WithSkipArgReorder(skipArgReorder bool) CmdOption
- func WithSkipFlagParsing(skipFlagParsing bool) CmdOption
- func WithUsage(usage string) CmdOption
- func WithUsageText(usageText string) CmdOption
- func WithUseShortOptionHandling(useShortOptionHandling bool) CmdOption
- type Command
- func (cmd *Command) AddSubCommand(subCommand *Command) *Command
- func (cmd *Command) Flags() []cli.Flag
- func (cmd *Command) Kernel() *cli.Command
- func (cmd *Command) OnAfterAction(action Action) *Command
- func (cmd *Command) OnBeforeAction(action Action) *Command
- func (cmd *Command) SubCommands() []cli.Command
- func (cmd *Command) WithAction(action Action) *Command
- func (cmd *Command) WithFlagBool(name string, value bool, usage string, required bool, hidden ...bool) *Command
- func (cmd *Command) WithFlagDuration(name string, value time.Duration, usage string, required bool, hidden ...bool) *Command
- func (cmd *Command) WithFlagFloat64(name string, value float64, usage string, required bool, hidden ...bool) *Command
- func (cmd *Command) WithFlagInt(name string, value int, usage string, required bool, hidden ...bool) *Command
- func (cmd *Command) WithFlagInt64(name string, value int64, usage string, required bool, hidden ...bool) *Command
- func (cmd *Command) WithFlagIntSlice(name string, value []int, usage string, required bool, hidden ...bool) *Command
- func (cmd *Command) WithFlagString(name string, value string, usage string, required bool, hidden ...bool) *Command
- func (cmd *Command) WithFlagStringSlice(name string, value []string, usage string, required bool, hidden ...bool) *Command
- func (cmd *Command) WithFlagUint(name string, value uint, usage string, required bool, hidden ...bool) *Command
- func (cmd *Command) WithFlagUint64(name string, value uint64, usage string, required bool, hidden ...bool) *Command
- func (cmd *Command) WithUsageErrorHandler(handler UsageErrorHandler) *Command
- type UsageErrorHandler
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmdConfig ¶
type CmdConfig 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 // Treat all flags as normal arguments if true SkipFlagParsing bool // Skip argument reordering which attempts to move flags before arguments, // but only works if all flags appear after all arguments. This behavior was // removed n version 2 since it only works under specific conditions so we // backport here by exposing it as an option for compatibility. SkipArgReorder bool // Boolean to hide built-in help command HideHelp 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 }
type CmdOption ¶
type CmdOption func(config *CmdConfig)
func WithAliases ¶
func WithArgsUsage ¶
func WithCategory ¶
func WithCustomHelpTemplate ¶
func WithDescription ¶
func WithHelpName ¶
func WithHidden ¶
func WithHideHelp ¶
func WithSkipArgReorder ¶
func WithSkipFlagParsing ¶
func WithUsageText ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewCommand ¶
func NewCommandWithConfig ¶
func (*Command) AddSubCommand ¶
func (*Command) OnAfterAction ¶
func (*Command) OnBeforeAction ¶
func (*Command) SubCommands ¶
func (*Command) WithAction ¶
func (*Command) WithFlagBool ¶
func (*Command) WithFlagDuration ¶
func (*Command) WithFlagFloat64 ¶
func (*Command) WithFlagInt ¶
func (*Command) WithFlagInt64 ¶
func (*Command) WithFlagIntSlice ¶
func (cmd *Command) WithFlagIntSlice(name string, value []int, usage string, required bool, hidden ...bool) *Command
WithFlagIntSlice example: main.ext -names Bob -names Tom -names Lisa
func (*Command) WithFlagString ¶
func (*Command) WithFlagStringSlice ¶
func (*Command) WithFlagUint ¶
func (*Command) WithFlagUint64 ¶
func (*Command) WithUsageErrorHandler ¶
func (cmd *Command) WithUsageErrorHandler(handler UsageErrorHandler) *Command
WithUsageErrorHandler Execute this function if a usage error occurs
Click to show internal directories.
Click to hide internal directories.