Documentation ¶
Index ¶
- type Action
- type CLI
- func (*CLI) Abort(err error)
- func (c *CLI) Action(action Action) *CLI
- func (c *CLI) AddCommand(command *Command)
- func (c *CLI) BoolFlag(name, description string, variable *bool) *CLI
- func (c *CLI) BoolFlagP(name, shorthand, description string, variable *bool) *CLI
- func (c *CLI) DefaultCommand(defaultCmd *Command) *CLI
- func (c *CLI) ExtraArgs() []string
- func (c *CLI) IntFlag(name, description string, variable *int) *CLI
- func (c *CLI) IntFlagP(name, shorthand, description string, variable *int) *CLI
- func (c *CLI) LongDescription(longdescription string) *CLI
- func (c *CLI) Name() string
- func (c *CLI) NewSubCommand(name, description string) *Command
- func (c *CLI) PrintBanner()
- func (c *CLI) PrintHelp()
- func (c *CLI) Run(args ...string) error
- func (c *CLI) SetBanner(fn func(*CLI) string)
- func (c *CLI) SetErrorHandler(fn func(string, error) error)
- func (c *CLI) SetInit(fn func(*CLI) error)
- func (c *CLI) ShortDescription() string
- func (c *CLI) StringFlag(name, description string, variable *string) *CLI
- func (c *CLI) StringFlagP(name, shorthand, description string, variable *string) *CLI
- func (c *CLI) Version() string
- type Command
- func (c *Command) Action(action Action) *Command
- func (c *Command) AddCommand(command *Command)
- func (c *Command) BoolFlag(name, description string, variable *bool) *Command
- func (c *Command) BoolFlagP(name, shorthand, description string, variable *bool) *Command
- func (c *Command) ExtraArgs() []string
- func (c *Command) Hide()
- func (c *Command) IntFlag(name, description string, variable *int) *Command
- func (c *Command) IntFlagP(name, shorthand, description string, variable *int) *Command
- func (c *Command) LongDescription(longDescription string) *Command
- func (c *Command) NewSubCommand(name, description string) *Command
- func (c *Command) PrintHelp()
- func (c *Command) StringFlag(name, description string, variable *string) *Command
- func (c *Command) StringFlagP(name, shorthand, description string, variable *string) *Command
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action func() error
Action represents a function that gets called when a command is used.
type CLI ¶
type CLI struct {
// contains filtered or unexported fields
}
CLI represents the ricecake CLI.
func (*CLI) AddCommand ¶
AddCommand adds a command to the CLI.
func (*CLI) DefaultCommand ¶
DefaultCommand sets the given command as the default one.
func (*CLI) LongDescription ¶
LongDescription sets the CLI's long description.
func (*CLI) NewSubCommand ¶
NewSubCommand creates a new subcommand for the CLI.
func (*CLI) SetErrorHandler ¶
SetErrorHandler sets the CLI's custom error handler.
func (*CLI) ShortDescription ¶
ShortDescription returns the CLI's short description.
func (*CLI) StringFlag ¶
StringFlag adds a string flag to the root command.
func (*CLI) StringFlagP ¶
StringFlag adds a string flag (with shorthand) to the root command.
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command represents a CLI command.
func NewCommand ¶
NewCommand creates a new command.
func (*Command) AddCommand ¶
AddCommand adds a subcommand to the command.
func (*Command) LongDescription ¶
LongDescription sets the long description for the command.
func (*Command) NewSubCommand ¶
NewSubCommand creates a new subcommand. NOTE: NewSubCommand registers a subcommand to the root command on creation.
func (*Command) PrintHelp ¶
func (c *Command) PrintHelp()
PrintHelp generates the help text for the command.
func (*Command) StringFlag ¶
StringFlag adds a string flag to the command.