Documentation ¶
Overview ¶
Package console provides a feature to implement CLI commands into your aah application easily and extensible.
Index ¶
- func AppHelpTemplate(t string)
- func CommandHelpTemplate(t string)
- func HelpFlagDesc(desc string)
- func ShowAppHelp(c *Context) error
- func ShowAppHelpAndExit(c *Context, exitCode int)
- func ShowCommandHelp(c *Context, cmd string) error
- func ShowCommandHelpAndExit(c *Context, cmd string, code int)
- func ShowSubcommandHelp(c *Context) error
- func ShowVersion(c *Context)
- func SubcommandHelpTemplate(t string)
- func VersionFlagDesc(desc string)
- func VersionPrinter(vp func(*Context))
- type Application
- type Args
- type Author
- type BoolFlag
- type Command
- type CommandsByName
- type Context
- type Flag
- type FlagsByName
- type Float64Flag
- type Int64Flag
- type IntFlag
- type IntSlice
- type StringFlag
- type StringSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppHelpTemplate ¶
func AppHelpTemplate(t string)
AppHelpTemplate method sets the custom text/template for application help. Console uses text/template to render templates.
func CommandHelpTemplate ¶
func CommandHelpTemplate(t string)
CommandHelpTemplate method sets the custom text/template for command help. Console uses text/template to render templates.
func HelpFlagDesc ¶
func HelpFlagDesc(desc string)
HelpFlagDesc method customized flag name, desc for HelpFlag.
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 ShowCommandHelp ¶
ShowCommandHelp prints help for the given command
func ShowCommandHelpAndExit ¶
ShowCommandHelpAndExit - exits with code after showing help
func ShowSubcommandHelp ¶
ShowSubcommandHelp prints help for the given subcommand.
func SubcommandHelpTemplate ¶
func SubcommandHelpTemplate(t string)
SubcommandHelpTemplate method sets the custom text/template for sub-command help. Console uses text/template to render templates.
func VersionFlagDesc ¶
func VersionFlagDesc(desc string)
VersionFlagDesc method customized flag name, desc for VersionFlag.
func VersionPrinter ¶
func VersionPrinter(vp func(*Context))
VersionPrinter method set custom func for version printer.
Types ¶
type Application ¶
Application is the main structure of a console application. It is recommended that an app be created with the func `console.NewApp()`.
func NewApp ¶
func NewApp() *Application
NewApp creates a new console Application with some reasonable defaults for Name, Usage, Version and Action.
type CommandsByName ¶
type CommandsByName = cli.CommandsByName
CommandsByName is a sorter interface for commands.
type Context ¶
Context is a type that is passed through to each Handler action in a console application. Context can be used to retrieve context-specific Args and parsed command-line options.
func NewContext ¶
func NewContext(app *Application, set *flag.FlagSet, parentCtx *Context) *Context
NewContext creates a new context. For use in when invoking an App or Command action.
type Flag ¶
Flag is a common interface related to parsing flags in console. For more advanced flag parsing techniques, it is recommended that this interface be implemented.
type StringSlice ¶
type StringSlice = cli.StringSlice
StringSlice is an opaque type for []string to satisfy flag.Value and flag.