Documentation
¶
Index ¶
- func AfterCommand(fn func(ctx *Context, duration time.Duration, err error))
- func RegisterCommand(c Command)
- func RegisterRootAttach(fn RootAttach)
- func Timestamp() string
- func ToPascal(snake string) string
- func ToSnake(s string) string
- type Command
- type CommandWithAliases
- type CommandWithArgs
- type CommandWithFlags
- type Context
- type Root
- type RootAttach
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AfterCommand ¶
AfterCommand registers a hook invoked after any Nimbus CLI command runs. This is used by observability tooling (e.g. Telescope) without coupling the cli package to those plugins.
func RegisterCommand ¶
func RegisterCommand(c Command)
RegisterCommand adds a command to the global CLI registry. Framework code and user applications can call this from init() to auto-register commands before the root executes.
func RegisterRootAttach ¶
func RegisterRootAttach(fn RootAttach)
RegisterRootAttach registers a function that attaches nested commands to the CLI root. Called once during Execute, after all RegisterCommand hooks.
func Timestamp ¶
func Timestamp() string
Timestamp returns a standard migration-style timestamp format.
Types ¶
type CommandWithAliases ¶
CommandWithAliases allows a command to define aliases.
type CommandWithArgs ¶
type CommandWithArgs interface {
Command
Args() int // Returns the exact number of required arguments, or -1 for any
}
CommandWithArgs allows a command to specify required positional arguments.
type CommandWithFlags ¶
CommandWithFlags allows a command to define its own flags.
type Context ¶
type Context struct {
Cmd *cobra.Command
Args []string
AppRoot string
Stdout io.Writer
Stderr io.Writer
Stdin io.Reader
UI *ui.UI
}
Context provides per-command information and helpers, similar to Laravel Artisan's Command context. It wraps Cobra's command and args and adds app root discovery and a UI helper.
type Root ¶
Root wraps the Cobra root command for the Nimbus CLI.
type RootAttach ¶
RootAttach is called after flat commands are registered; use it to add nested commands (e.g. `nimbus plugin install` under `nimbus plugin`).