Documentation ¶
Overview ¶
Package tool is used for parsing input parameters, and starting subcommands (aka tools).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context stores information about available subcommands (aka tools) and other related things that are necessary for their start.
func NewContext ¶
NewContext gets a number of handlers as arguments, allocates a new Context and returns it.
type Handler ¶
type Handler struct { // Run is an entry function of the handler. // The args are the arguments after the command name. Run func(hs []Handler, i int, args Data) // Default means the handler must be executed if no arguments are // received from user (in addition to when it is called explicitly). // Only first default handler is used, others will be ignored. Default bool Name string // Name of the handler, e.g. "new" or "generate stuff". Usage string // Possible arguments of the command, e.g. "[input] [output]". Info string // One line description of the command. Desc string // Detailed description of what the command does. Flags flag.FlagSet // Set of flags specific to the command. }
Handler is a type for representation of a subcommand (aka tool) such as "cli run" or "cli new".
Click to show internal directories.
Click to hide internal directories.