Documentation ¶
Overview ¶
Package subcmd provides sub commander.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command repreesents a sub-command, and implements Runner interface.
func DefineCommand ¶
func DefineCommand(name, desc string, fn CommandFunc) Command
DefineCommand defines a Command with name, desc, and function.
type CommandFunc ¶
CommandFunc is handler of sub-command, and an entry point.
type Runner ¶
type Runner interface { // Name returns name of runner. Name() string // Desc returns description of runner. Desc() string // Run runs runner with context and arguments. Run(ctx context.Context, args []string) error }
Runner defines a base interface for Command and Set. Runner interface is defined for use only with DefineSet function.
type Set ¶
type Set struct { Runners []Runner // contains filtered or unexported fields }
Set provides set of Commands or nested Sets.
func DefineRootSet ¶
DefineRootSet defines a set of Runners which used as root of Set (maybe passed to Run).
Click to show internal directories.
Click to hide internal directories.