Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExitCommandExecutionError ¶ added in v0.2.0
func ExitCommandExecutionError()
ExitCommandExecutionError exits with the exit code to return when an error occurred when executing a command.
func ExitCommandInterpretationError ¶ added in v0.2.0
func ExitCommandInterpretationError()
ExitCommandInterpretationError exits with the exit code to return when there was an error interpreting the command typed by the user. Should technically be returned if the help message will be printed and the user didn't explicitly request for the help message to be printed.
Types ¶
type Command ¶
type Command interface { // Init initializes the command. Place all initialization code here. Function should be // called when initializing the command hierarch (if sub-command, within the parent command's // Init function). Init(helpFlagName string, helpFlagDescription string) // GetName returns the name of the command. This is what will be displayed when a user requests to see // the command's manual. GetName() string // GetDescription returns the description of the command. This is what will be displayed when a user requests to // see the command's manual. GetDescription() string // GetFlagSet returns flag.FlagSet holding arguments linked to the command. If command's arguments linked to // the default FlagSet, then return nil. GetFlagSet() *flag.FlagSet // GetSubCommands returns a list sub-commands that are children of this command. GetSubCommands() []Command // GetHelpFlag returns a pointer to the bool linked to the command's help flag. GetHelpFlag() *bool // Process executes the logic for the command. If command has sub-commands, this function will never be called. Process() }
Command is the interface to implement if you want to define a (sub)command
Click to show internal directories.
Click to hide internal directories.