Documentation
¶
Index ¶
- Constants
- Variables
- func CompleteStringArgsDispatcher(disp *StringArgsDispatcher)
- func CompleteSuperStringArgsDispatcher(disp *SuperStringArgsDispatcher)
- func IsErrCommandNotFound(err error) bool
- type ErrCommandNotFound
- type ErrSuperCommandNotFound
- type StringArgsCommandLogger
- type StringArgsCommandLoggerFunc
- type StringArgsDispatcher
- func (disp *StringArgsDispatcher) AddCommand(command, description string, commandFunc function.Wrapper, ...) error
- func (disp *StringArgsDispatcher) AddDefaultCommand(description string, commandFunc function.Wrapper, ...) error
- func (disp *StringArgsDispatcher) Commands() []string
- func (disp *StringArgsDispatcher) Dispatch(ctx context.Context, command string, args ...string) error
- func (disp *StringArgsDispatcher) DispatchCombinedCommandAndArgs(ctx context.Context, commandAndArgs []string) (command string, err error)
- func (disp *StringArgsDispatcher) DispatchDefaultCommand() error
- func (disp *StringArgsDispatcher) HasCommnd(command string) bool
- func (disp *StringArgsDispatcher) HasDefaultCommnd() bool
- func (disp *StringArgsDispatcher) MustAddCommand(command, description string, commandFunc function.Wrapper, ...)
- func (disp *StringArgsDispatcher) MustAddDefaultCommand(description string, commandFunc function.Wrapper, ...)
- func (disp *StringArgsDispatcher) MustDispatch(ctx context.Context, command string, args ...string)
- func (disp *StringArgsDispatcher) MustDispatchCombinedCommandAndArgs(ctx context.Context, commandAndArgs []string) (command string)
- func (disp *StringArgsDispatcher) MustDispatchDefaultCommand()
- func (disp *StringArgsDispatcher) PrintCommands(appName string)
- func (disp *StringArgsDispatcher) PrintCommandsUsageIntro(appName string, output io.Writer)
- type SuperStringArgsDispatcher
- func (disp *SuperStringArgsDispatcher) AddCommand(command, description string, commandFunc function.Wrapper, ...) error
- func (disp *SuperStringArgsDispatcher) AddDefaultCommand(description string, commandFunc function.Wrapper, ...) error
- func (disp *SuperStringArgsDispatcher) AddSuperCommand(superCommand string) (subDisp *StringArgsDispatcher, err error)
- func (disp *SuperStringArgsDispatcher) Commands() []string
- func (disp *SuperStringArgsDispatcher) Dispatch(ctx context.Context, superCommand, command string, args ...string) error
- func (disp *SuperStringArgsDispatcher) DispatchCombinedCommandAndArgs(ctx context.Context, commandAndArgs []string) (superCommand, command string, err error)
- func (disp *SuperStringArgsDispatcher) DispatchDefaultCommand() error
- func (disp *SuperStringArgsDispatcher) HasCommnd(superCommand string) bool
- func (disp *SuperStringArgsDispatcher) HasSubCommand(superCommand, command string) bool
- func (disp *SuperStringArgsDispatcher) MustAddCommand(command, description string, commandFunc function.Wrapper, ...)
- func (disp *SuperStringArgsDispatcher) MustAddDefaultCommand(description string, commandFunc function.Wrapper, ...)
- func (disp *SuperStringArgsDispatcher) MustAddSuperCommand(superCommand string) (subDisp *StringArgsDispatcher)
- func (disp *SuperStringArgsDispatcher) MustDispatch(ctx context.Context, superCommand, command string, args ...string)
- func (disp *SuperStringArgsDispatcher) MustDispatchCombinedCommandAndArgs(ctx context.Context, commandAndArgs []string) (superCommand, command string)
- func (disp *SuperStringArgsDispatcher) MustDispatchDefaultCommand()
- func (disp *SuperStringArgsDispatcher) PrintCommands(appName string)
- func (disp *SuperStringArgsDispatcher) PrintCommandsUsageIntro(appName string, output io.Writer)
- func (disp *SuperStringArgsDispatcher) SubCommands(superCommand string) []string
Constants ¶
View Source
const (
DefaultCommand = ""
)
Variables ¶
Functions ¶
func CompleteStringArgsDispatcher ¶
func CompleteStringArgsDispatcher(disp *StringArgsDispatcher)
func CompleteSuperStringArgsDispatcher ¶
func CompleteSuperStringArgsDispatcher(disp *SuperStringArgsDispatcher)
func IsErrCommandNotFound ¶
IsErrCommandNotFound returns true if the passed error can be unwrapped to either ErrCommandNotFound or ErrSuperCommandNotFound.
Types ¶
type ErrCommandNotFound ¶
type ErrCommandNotFound string
func (ErrCommandNotFound) Error ¶
func (e ErrCommandNotFound) Error() string
type ErrSuperCommandNotFound ¶
type ErrSuperCommandNotFound string
func (ErrSuperCommandNotFound) Error ¶
func (e ErrSuperCommandNotFound) Error() string
type StringArgsCommandLogger ¶
type StringArgsCommandLoggerFunc ¶
func (StringArgsCommandLoggerFunc) LogStringArgsCommand ¶
func (f StringArgsCommandLoggerFunc) LogStringArgsCommand(command string, args []string)
type StringArgsDispatcher ¶
type StringArgsDispatcher struct {
// contains filtered or unexported fields
}
func NewStringArgsDispatcher ¶
func NewStringArgsDispatcher(loggers ...StringArgsCommandLogger) *StringArgsDispatcher
func (*StringArgsDispatcher) AddCommand ¶
func (disp *StringArgsDispatcher) AddCommand(command, description string, commandFunc function.Wrapper, resultsHandlers ...function.ResultsHandler) error
func (*StringArgsDispatcher) AddDefaultCommand ¶
func (disp *StringArgsDispatcher) AddDefaultCommand(description string, commandFunc function.Wrapper, resultsHandlers ...function.ResultsHandler) error
func (*StringArgsDispatcher) Commands ¶
func (disp *StringArgsDispatcher) Commands() []string
func (*StringArgsDispatcher) DispatchCombinedCommandAndArgs ¶
func (*StringArgsDispatcher) DispatchDefaultCommand ¶
func (disp *StringArgsDispatcher) DispatchDefaultCommand() error
func (*StringArgsDispatcher) HasCommnd ¶
func (disp *StringArgsDispatcher) HasCommnd(command string) bool
func (*StringArgsDispatcher) HasDefaultCommnd ¶
func (disp *StringArgsDispatcher) HasDefaultCommnd() bool
func (*StringArgsDispatcher) MustAddCommand ¶
func (disp *StringArgsDispatcher) MustAddCommand(command, description string, commandFunc function.Wrapper, resultsHandlers ...function.ResultsHandler)
func (*StringArgsDispatcher) MustAddDefaultCommand ¶
func (disp *StringArgsDispatcher) MustAddDefaultCommand(description string, commandFunc function.Wrapper, resultsHandlers ...function.ResultsHandler)
func (*StringArgsDispatcher) MustDispatch ¶
func (disp *StringArgsDispatcher) MustDispatch(ctx context.Context, command string, args ...string)
func (*StringArgsDispatcher) MustDispatchCombinedCommandAndArgs ¶
func (disp *StringArgsDispatcher) MustDispatchCombinedCommandAndArgs(ctx context.Context, commandAndArgs []string) (command string)
func (*StringArgsDispatcher) MustDispatchDefaultCommand ¶
func (disp *StringArgsDispatcher) MustDispatchDefaultCommand()
func (*StringArgsDispatcher) PrintCommands ¶
func (disp *StringArgsDispatcher) PrintCommands(appName string)
func (*StringArgsDispatcher) PrintCommandsUsageIntro ¶
func (disp *StringArgsDispatcher) PrintCommandsUsageIntro(appName string, output io.Writer)
type SuperStringArgsDispatcher ¶
type SuperStringArgsDispatcher struct {
// contains filtered or unexported fields
}
func NewSuperStringArgsDispatcher ¶
func NewSuperStringArgsDispatcher(loggers ...StringArgsCommandLogger) *SuperStringArgsDispatcher
func (*SuperStringArgsDispatcher) AddCommand ¶
func (disp *SuperStringArgsDispatcher) AddCommand(command, description string, commandFunc function.Wrapper, resultsHandlers ...function.ResultsHandler) error
func (*SuperStringArgsDispatcher) AddDefaultCommand ¶
func (disp *SuperStringArgsDispatcher) AddDefaultCommand(description string, commandFunc function.Wrapper, resultsHandlers ...function.ResultsHandler) error
func (*SuperStringArgsDispatcher) AddSuperCommand ¶
func (disp *SuperStringArgsDispatcher) AddSuperCommand(superCommand string) (subDisp *StringArgsDispatcher, err error)
func (*SuperStringArgsDispatcher) Commands ¶
func (disp *SuperStringArgsDispatcher) Commands() []string
func (*SuperStringArgsDispatcher) DispatchCombinedCommandAndArgs ¶
func (*SuperStringArgsDispatcher) DispatchDefaultCommand ¶
func (disp *SuperStringArgsDispatcher) DispatchDefaultCommand() error
func (*SuperStringArgsDispatcher) HasCommnd ¶
func (disp *SuperStringArgsDispatcher) HasCommnd(superCommand string) bool
func (*SuperStringArgsDispatcher) HasSubCommand ¶
func (disp *SuperStringArgsDispatcher) HasSubCommand(superCommand, command string) bool
func (*SuperStringArgsDispatcher) MustAddCommand ¶
func (disp *SuperStringArgsDispatcher) MustAddCommand(command, description string, commandFunc function.Wrapper, resultsHandlers ...function.ResultsHandler)
func (*SuperStringArgsDispatcher) MustAddDefaultCommand ¶
func (disp *SuperStringArgsDispatcher) MustAddDefaultCommand(description string, commandFunc function.Wrapper, resultsHandlers ...function.ResultsHandler)
func (*SuperStringArgsDispatcher) MustAddSuperCommand ¶
func (disp *SuperStringArgsDispatcher) MustAddSuperCommand(superCommand string) (subDisp *StringArgsDispatcher)
func (*SuperStringArgsDispatcher) MustDispatch ¶
func (disp *SuperStringArgsDispatcher) MustDispatch(ctx context.Context, superCommand, command string, args ...string)
func (*SuperStringArgsDispatcher) MustDispatchCombinedCommandAndArgs ¶
func (disp *SuperStringArgsDispatcher) MustDispatchCombinedCommandAndArgs(ctx context.Context, commandAndArgs []string) (superCommand, command string)
func (*SuperStringArgsDispatcher) MustDispatchDefaultCommand ¶
func (disp *SuperStringArgsDispatcher) MustDispatchDefaultCommand()
func (*SuperStringArgsDispatcher) PrintCommands ¶
func (disp *SuperStringArgsDispatcher) PrintCommands(appName string)
func (*SuperStringArgsDispatcher) PrintCommandsUsageIntro ¶
func (disp *SuperStringArgsDispatcher) PrintCommandsUsageIntro(appName string, output io.Writer)
func (*SuperStringArgsDispatcher) SubCommands ¶
func (disp *SuperStringArgsDispatcher) SubCommands(superCommand string) []string
Click to show internal directories.
Click to hide internal directories.