Versions in this module Expand all Collapse all v1 v1.0.0 Sep 20, 2025 Changes in this version + var ErrEmptyCommandName = errors.New("empty command name") + var ErrNilCommand = errors.New("nil command") + var ErrNilFS = errors.New("fs.FS is nil") + var ErrNilSubCommand = errors.New("nil sub-command") + var ErrNoCommand = errors.New("no command specified") + var ErrNoCommands = errors.New("no commands registered") + func Exit(cmd plugins.Stdioer, code int, err error) + type Aliaser interface + CmdAliases func() []string + type Cmd struct + Aliases []string + Commands map[string]Commander + Desc string + ExitFn func(int) error + Feeder plugins.FeederFn + Name string + func NewCmd(name string, opts ...Option) (*Cmd, error) + func (cmd *Cmd) CmdAliases() []string + func (cmd *Cmd) CmdName() string + func (cmd *Cmd) Description() string + func (cmd *Cmd) Exit(code int) error + func (cmd *Cmd) ExitWithContext(ctx context.Context, code int) error + func (cmd *Cmd) FileSystem() (fs.FS, error) + func (cmd *Cmd) Init() error + func (cmd *Cmd) InitWithContext(ctx context.Context) error + func (cmd *Cmd) Logger() *slog.Logger + func (cmd *Cmd) Main(ctx context.Context, pwd string, args []string) error + func (cmd *Cmd) MainWithContext(ctx context.Context, pwd string, args []string) error + func (cmd *Cmd) MarshalJSON() ([]byte, error) + func (cmd *Cmd) PluginFeeder() plugins.FeederFn + func (cmd *Cmd) PluginName() string + func (cmd *Cmd) ScopedPlugins() plugins.Plugins + func (cmd *Cmd) SetFileSystem(cab fs.FS) error + func (cmd *Cmd) SetStdio(oi iox.IO) error + func (cmd *Cmd) Stdio() iox.IO + func (cmd *Cmd) String() string + func (cmd *Cmd) SubCommands() []Commander + type Commander = plugcmd.Commander + type ContextualCommander interface + MainWithContext func(ctx context.Context, pwd string, args []string) error + type ContextualExiter interface + ExitWithContext func(ctx context.Context, code int) error + type ContextualInitializer interface + InitWithContext func(ctx context.Context) error + type Describer interface + Description func() string + type Env struct + func (e *Env) Get(key string) string + func (e *Env) Set(key, value string) + type ErrUnknownCommand string + func (e ErrUnknownCommand) Error() string + type Exiter interface + Exit func(code int) error + type Logger interface + Logger func() *slog.Logger + type ModernCommander interface + type Namer interface + CmdName func() string + type Option func(*Cmd) error + func WithAliases(aliases ...string) Option + func WithDescription(desc string) Option + func WithExitFunction(exitFn func(int) error) Option + func WithFS(filesystem fs.FS) Option + func WithLogger(logger *slog.Logger) Option + func WithPluginFeeder(feeder plugins.FeederFn) Option + func WithStdio(io iox.IO) Option + func WithSubCommand(name string, subcmd Commander) Option