Versions in this module Expand all Collapse all v0 v0.1.1 Oct 2, 2020 Changes in this version + const CommandReturnCodeHelp + type Args struct + type CLI struct + func New(config *Config) *CLI + func (cli *CLI) Run(ctx context.Context, args []string) (int, error) + func (cli *CLI) WriteHelp(data string) (int, error) + type Command interface + Help func() string + Run func(ctx context.Context, args []string) int + Synopsis func() string + type Config struct + Commands map[string]Command + HelpFunc HelpFunc + HelpWriter io.Writer + Name string + Version string + func DefaultConfig() *Config + func (c *Config) Merge(b *Config) *Config + type HelpFunc func(map[string]Command) string + func DefaultHelpFunc(app string) HelpFunc + func FilteredHelpFunc(include []string, f HelpFunc) HelpFunc + type MockCommand struct + HelpText string + RunArgs []string + RunCalled bool + RunReturnCode int + SynopsisText string + func (c *MockCommand) Help() string + func (c *MockCommand) Run(ctx context.Context, args []string) int + func (c *MockCommand) Synopsis() string + type NamedCommand interface + Name func() string + type Router struct + func NewRouter() *Router + func (r *Router) AddCommand(n string, cmd Command) error + func (r *Router) AddMissingParents(genCmd func() Command) + func (r *Router) GetCommand(n string) (Command, error) + func (r *Router) GetLongestPrefix(s string) (string, interface{}, bool) + func (r *Router) GetParent(n string) string + func (r *Router) GetSubcommands(prefix string) map[string]Command + type SimpleUI struct + ErrorWriter io.Writer + Reader io.Reader + Writer io.Writer + func (u *SimpleUI) Error(message string) + func (u *SimpleUI) Info(message string) + func (u *SimpleUI) Output(message string) + func (u *SimpleUI) Warn(message string) + type UI interface + Error func(string) + Info func(string) + Output func(string) + Warn func(string)