Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCommandNotFound = errors.New("command not found")
Functions ¶
This section is empty.
Types ¶
type ArgsProcessor ¶
type ArgsProcessorFunc ¶
ArgsProcessorFunc defines a functional implementation of ArgsProcessor.
func (ArgsProcessorFunc) ProcessArgs ¶
func (f ArgsProcessorFunc) ProcessArgs(cmd *Command, args []string) []string
ArgsProcessorFunc implements ArgsProcessor.
type FlagRegistry ¶
type FlagRegistry interface { // RegisterFlags can be implemented to register custom flags. RegisterFlags(cmd *Command, flags *pflag.FlagSet) }
FlagRegistry contains optional methods for parsing CLI arguments.
type FlagRegistryFunc ¶
FlagRegistryFunc defines a functional implementation of FlagRegistry.
func (FlagRegistryFunc) RegisterFlags ¶
func (f FlagRegistryFunc) RegisterFlags(cmd *Command, flags *pflag.FlagSet)
FlagRegistryFunc implements FlagRegistry.
type Handler ¶
type Handler interface { // Handle receives the context and the arguments leftover from parsing. // When the first return value is non-nil and the error is nil, the value // will be passed as an argument to the subcommand. Handle(ctx context.Context, args []string) error }
Handler is command line handler.
type HandlerFunc ¶
HandlerFunc defines a functional implementation of Handler.
type Params ¶
type Params struct { Name string Desc string ArgsPreProcessor ArgsProcessor ArgsPostProcessor ArgsProcessor FlagRegistry FlagRegistry Handler Handler SubCommands []*Command }
Click to show internal directories.
Click to hide internal directories.