Documentation
¶
Index ¶
Constants ¶
View Source
const ( ExitStatusSuccess = iota ExitStatusUnknownError ExitStatusInvalidArgs )
Constants for exit statuses
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Commands []Command
Flags []Flag
// UserOut logs messages to end-users
UserOut io.Writer
// UserErr logs errors to end-users
UserErr io.Writer
// InternalOut logs messages to ops
InternalOut io.Writer
Before func(c *Context) error
Exit <-chan struct{}
}
App is the main structure for any CLI application
type Command ¶
type Command struct {
Name string
Flags []Flag
Run func(context *Context) (exitStatus int, err error)
}
Command holds a single subcommand
type Context ¶
type Context struct {
App *App
CommandName string
Command *Command
Flags *FlagSet
Args []string
Exit <-chan struct{}
}
Context holds the context of a command execution
type FlagSet ¶
FlagSet encapsulates the args flags
func NewFlagSet ¶
NewFlagSet creates a new flag.FlagSet object and parses the flags
func (*FlagSet) StringSlice ¶
StringSlice looks up a flag as an array of strings
type StringFlag ¶
StringFlag holds a single args string flag
func (StringFlag) Apply ¶
func (flag StringFlag) Apply(set *flag.FlagSet)
Apply applies a flag to the FlagSet
type StringSliceFlag ¶
StringSliceFlag holds a single args string flag
func (StringSliceFlag) Apply ¶
func (flag StringSliceFlag) Apply(set *flag.FlagSet)
Apply applies a flag to the FlagSet
Click to show internal directories.
Click to hide internal directories.