Documentation
¶
Index ¶
- func CommandWithDescription(description string) func(*namedRunnable)
- func WithDescription(description string) func(*CommandOption)
- func WithOutcomeCallback(outcomeCallback func(context.Context, error)) func(*CommandOption)
- type Command
- type CommandOption
- type CommandSet
- func (cs *CommandSet) Add(name string, command Runnable, options ...func(*namedRunnable))
- func (cs *CommandSet) CommandDescriptions() [][]string
- func (cs *CommandSet) Help() string
- func (cs *CommandSet) Run(ctx context.Context, args []string) error
- func (cs *CommandSet) RunMain(name, version string)
- type HelpError
- type Runnable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandWithDescription ¶
func CommandWithDescription(description string) func(*namedRunnable)
func WithDescription ¶
func WithDescription(description string) func(*CommandOption)
func WithOutcomeCallback ¶
func WithOutcomeCallback(outcomeCallback func(context.Context, error)) func(*CommandOption)
Types ¶
type Command ¶
type Command[C any] struct { Callback func(context.Context, C) error CommandOption }
func NewCommand ¶
type CommandOption ¶
type CommandOption struct {
// contains filtered or unexported fields
}
type CommandSet ¶
type CommandSet struct {
// contains filtered or unexported fields
}
func NewCommandSet ¶
func NewCommandSet() *CommandSet
func (*CommandSet) Add ¶
func (cs *CommandSet) Add(name string, command Runnable, options ...func(*namedRunnable))
func (*CommandSet) CommandDescriptions ¶
func (cs *CommandSet) CommandDescriptions() [][]string
func (*CommandSet) Help ¶
func (cs *CommandSet) Help() string
func (*CommandSet) RunMain ¶
func (cs *CommandSet) RunMain(name, version string)
RunMain should run from the main command, it will handle OS Exits, and should be the only goroutine running.
Click to show internal directories.
Click to hide internal directories.