Documentation
¶
Index ¶
- type App
- type CallbackHandler
- type Command
- type CommandHandler
- type Context
- func (c *Context) Argument(name string) string
- func (c *Context) Confirm(msg string) bool
- func (c *Context) Flag(name string) (interface{}, error)
- func (c *Context) FlagCollection(name string) []string
- func (c *Context) FlagString(name string) string
- func (c *Context) Get(key string) interface{}
- func (c *Context) Input(msg string) (string, error)
- func (c *Context) Output(value string)
- func (c *Context) Outputf(format string, args ...interface{})
- func (c *Context) Set(key string, value interface{})
- type FlagCollection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
App contains the configuration for a command line application
func (*App) Before ¶ added in v0.0.2
func (a *App) Before(fn CallbackHandler)
Before adds a function handler
This auto-excludes the help & version commands
func (*App) BeforeExcluding ¶ added in v0.0.3
func (a *App) BeforeExcluding(fn CallbackHandler, exclude ...string)
BeforeExcluding adds a function handler but doesn't run it for the passed command names
type CallbackHandler ¶ added in v0.0.2
CallbackHandler is the function signature for app callbacks
type Command ¶
type Command struct {
Description string
// contains filtered or unexported fields
}
Command represents a single sub-command in the application
func (*Command) Configure ¶
Configure calls the passed function with the command.
This is a convenience method for chaining `app.Command("thing", thingHandler).Configure(func(c *Command) { ... })`
type CommandHandler ¶
CommandHandler is the function that will be called when a user performs a sub-command
type Context ¶
type Context struct {
CommandName string
// contains filtered or unexported fields
}
Context is used to hold the state of the application
func (*Context) Flag ¶
Flag returns a flag with the passed name. If the flag is not found an error will be returned.
func (*Context) FlagCollection ¶ added in v0.0.4
func (*Context) FlagString ¶
FlagString returns a flag string value.
This will panic if the flag does not exist
type FlagCollection ¶ added in v0.0.4
type FlagCollection struct {
Values []string
}
FlagCollection contains a list of flags
func (*FlagCollection) Set ¶ added in v0.0.4
func (f *FlagCollection) Set(value string) error
Set adds a flag value
func (*FlagCollection) String ¶ added in v0.0.4
func (f *FlagCollection) String() string