Documentation
¶
Overview ¶
Package cmd is an interface for building a command line binary
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cmd ¶
type Cmd interface {
// Init initialises options
// Note: Use Run to parse command line
Init(opts ...Option) error
// Options set within this command
Options() Options
// The cli app within this cmd
App() *cli.App
// Run executes the command
Run() error
// Implementation
String() string
}
TODO: replace App with RegisterCommand/RegisterFlags
type Options ¶
type Options struct {
// Name of the application
Name string
// Description of the application
Description string
// Version of the application
Version string
// Action to execute when Run is called and there is no subcommand
// TODO replace with a build in context
Action func(*cli.Context) error
// TODO replace with built in command definition
Commands []*cli.Command
// TODO replace with built in flags definition
Flags []cli.Flag
// Other options for implementations of the interface
// can be stored in a context
Context context.Context
}
Click to show internal directories.
Click to hide internal directories.