Documentation
¶
Index ¶
- func FullName(c Command) []string
- type Base
- func (c *Base) ErrWriter() io.Writer
- func (c Base) Execute() int
- func (c Base) ExecuteContext(ctx context.Context) int
- func (c Base) FS() *wflag.FlagSet
- func (c *Base) Hidden() bool
- func (c Base) IsHelpRequested(err error) bool
- func (c Base) Name() string
- func (c *Base) OutWriter() io.Writer
- func (c *Base) Parent() Command
- func (c Base) Parse(args []string) error
- func (c *Base) PrintError(msg string)
- func (c *Base) SetErrWriter(w io.Writer)
- func (c *Base) SetOutWriter(w io.Writer)
- func (c *Base) SetParent(parent Command)
- func (c Base) ShortDescription() string
- func (c *Base) Usage() string
- type Command
- type Config
- type Help
- func (c *Help) Execute() int
- func (c *Help) ExecuteContext(ctx context.Context) int
- func (c *Help) IsHelpRequested(err error) bool
- func (c *Help) Name() string
- func (c *Help) Parent() Command
- func (c *Help) Parse(args []string) error
- func (c *Help) SetErrWriter(w io.Writer)
- func (c *Help) SetOutWriter(w io.Writer)
- func (c *Help) SetParent(parent Command)
- func (c *Help) ShortDescription() string
- func (c *Help) Usage() string
- type HelpSupported
- type HiddenSupported
- type ParentBase
- func (c *ParentBase) AddCommands(commands ...Command) *ParentBase
- func (c *ParentBase) Commands() []Command
- func (c *ParentBase) Execute() int
- func (c *ParentBase) ExecuteContext(ctx context.Context) int
- func (c *ParentBase) FullHelpCommandName() string
- func (c *ParentBase) Parse(args []string) error
- func (c *ParentBase) SetErrWriter(w io.Writer)
- func (c *ParentBase) SetOutWriter(w io.Writer)
- func (c *ParentBase) Usage() string
- type ParentCommand
- type Root
- type SubCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
func (Base) ExecuteContext ¶
ExecuteContext is the same as Execute() but accept a context as an argument.
func (Base) IsHelpRequested ¶
IsHelpRequested will return true when the help was requested in Parse.
func (*Base) PrintError ¶
func (*Base) SetErrWriter ¶
func (*Base) SetOutWriter ¶
func (Base) ShortDescription ¶
type Help ¶
type Help struct {
// contains filtered or unexported fields
}
func NewHelp ¶
func NewHelp(root ParentCommand) *Help
func (*Help) IsHelpRequested ¶
func (*Help) SetErrWriter ¶
func (*Help) SetOutWriter ¶
func (*Help) ShortDescription ¶
type HelpSupported ¶
type HelpSupported interface {
FullHelpCommandName() string
}
type HiddenSupported ¶
type HiddenSupported interface {
Hidden() bool
}
type ParentBase ¶
type ParentBase struct {
*Base
// contains filtered or unexported fields
}
func NewParentBase ¶
func NewParentBase(name string, cfg Config) *ParentBase
func (*ParentBase) AddCommands ¶
func (c *ParentBase) AddCommands(commands ...Command) *ParentBase
AddCommands add subcommands
func (*ParentBase) Commands ¶
func (c *ParentBase) Commands() []Command
Commands returns subcommands.
func (*ParentBase) Execute ¶
func (c *ParentBase) Execute() int
Execute executes the main processing of the command.
func (*ParentBase) ExecuteContext ¶
func (c *ParentBase) ExecuteContext(ctx context.Context) int
ExecuteContext is the same as Execute() but accept a context as an argument.
func (*ParentBase) FullHelpCommandName ¶
func (c *ParentBase) FullHelpCommandName() string
FullHelpCommandName returns full name of help command (rootName helpName subName)
func (*ParentBase) SetErrWriter ¶
func (c *ParentBase) SetErrWriter(w io.Writer)
func (*ParentBase) SetOutWriter ¶
func (c *ParentBase) SetOutWriter(w io.Writer)
func (*ParentBase) Usage ¶
func (c *ParentBase) Usage() string
type ParentCommand ¶
type Root ¶
type Root struct {
*ParentBase
}
func (*Root) AddCommands ¶
func (*Root) ParseAndExecute ¶
ParseAndExecute parses and executes command.
type SubCommand ¶
Click to show internal directories.
Click to hide internal directories.