Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Disguard = func(err error) {}
Disguard is used as a High Order Function to disguard error messages
var ( // ErrShowHelp is a sentinel error message for showing help. ErrShowHelp = errors.New("show help") )
var Nothing = func(g *group.Group) { g.Add(func(context.Context) error { return nil }, Disguard) }
Nothing is used as a High Order Function to consume all group event runs into nothing.
Functions ¶
This section is empty.
Types ¶
type CommandContext ¶
CommandContext is the context the command was run with.
type Runnable ¶
type Runnable interface { // Run runs the actual CLI bases on the arguments given. Run(args []string) (int, error) }
Runnable allows the shell to interact with a given runnable type.
type Shell ¶
type Shell struct {
// contains filtered or unexported fields
}
Shell defines a REPL that can be interactively accessed.
func (*Shell) FlagSet ¶
FlagSet returns the FlagSet associated with the command. All the flags are parsed before running the command.
func (*Shell) Help ¶
Help should return a long-form help text that includes the command-line usage. A brief few sentences explaining the function of the command, and the complete list of flags the command accepts.
func (*Shell) Init ¶
func (c *Shell) Init([]string, CommandContext) error
Init is called with all the args required to run a command. This is separated from Run, to allow the preperation of a command, before it's run.
func (*Shell) Run ¶
Run subscribes to the group for executing the various run commands. The subscriptions to the group are handled by the callee.
type Store ¶
type Store interface { // WalkPrefix is used to walk the tree under a prefix WalkPrefix(prefix string, fn radix.WalkFn) }
Store holds the command prefixes to able to walk over.
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
Text defines a simple text based command, that can be useful for creating commands that require more text based explanations.
func (*Text) FlagSet ¶
FlagSet returns the FlagSet associated with the command. All the flags are parsed before running the command.
func (*Text) Help ¶
Help should return a long-form help text that includes the command-line usage. A brief few sentences explaining the function of the command, and the complete list of flags the command accepts.
func (*Text) Init ¶
func (c *Text) Init([]string, CommandContext) error
Init is called with all the args required to run a command. This is separated from Run, to allow the preperation of a command, before it's run.
func (*Text) Run ¶
Run subscribes to the group for executing the various run commands. The subscriptions to the group are handled by the callee.