Documentation ¶
Index ¶
- Constants
- func Exit(cmd plugins.Stdioer, code int, err error)
- type Cmd
- 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) FileSystem() (fs.FS, error)
- func (cmd *Cmd) Init() error
- func (cmd *Cmd) Main(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
- type Env
- type ErrUnknownCommand
- type Exiter
Constants ¶
View Source
const ( ErrNoCommand = stringErr("no command specified") ErrNoCommands = stringErr("no commands registered") )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cmd ¶
type Cmd struct { iox.IO // IO to be used by the command fs.FS // FS to be used by the command Aliases []string // Aliases for the command Commands map[string]Commander // Sub commands for the command Feeder plugins.FeederFn // Plugins for the command Name string // Name of the command Desc string // Description of the command ExitFn func(int) error // ExitFn is used by the Exit method. // contains filtered or unexported fields }
func (*Cmd) CmdAliases ¶
CmdAliases returns the aliases for the command.
func (*Cmd) Description ¶
func (*Cmd) Init ¶
Init will initialize the command. It should be called before the command is used.
func (*Cmd) MarshalJSON ¶
MarshalJSON returns a JSON representation of the command.
func (*Cmd) PluginFeeder ¶
Plugins will provider a single FeederFn that will return all of the plugins that are available to the command.
func (*Cmd) ScopedPlugins ¶
ScopedPlugins returns the plugins scoped to the command. If the plugins include the current command, it will be removed from the returned list.
func (*Cmd) SubCommands ¶
SubCommands returns the sub-commands for the command.
type ErrUnknownCommand ¶
type ErrUnknownCommand string
func (ErrUnknownCommand) Error ¶
func (e ErrUnknownCommand) Error() string
Click to show internal directories.
Click to hide internal directories.