Documentation
¶
Overview ¶
Package root provides the reusable root Cobra command constructor that wires configuration loading, logging setup, update checks, and feature-flagged subcommand registration (version, update, init, docs, MCP).
The NewCmdRoot and NewCmdRootWithConfig functions build a root command whose PersistentPreRunE handles config merging (local files + embedded assets), log level/format configuration, and optional self-update prompting before any subcommand executes.
Index ¶
- Variables
- func Execute(rootCmd *cobra.Command, props *p.Props)
- func NewCmdRoot(props *p.Props, subcommands ...*cobra.Command) *cobra.Command
- func NewCmdRootWithConfig(props *p.Props, configPaths []string, subcommands ...*cobra.Command) *cobra.Command
- type ConfigLoadOptions
- type FlagValues
- type OutdatedVersionOption
- type UpdateCheckResult
Constants ¶
This section is empty.
Variables ¶
var ErrUpdateComplete = errors.New("update complete — restart required")
ErrUpdateComplete is returned by PersistentPreRunE when a self-update has completed successfully. The Execute wrapper handles this by exiting cleanly without logging an error.
Functions ¶
Types ¶
type ConfigLoadOptions ¶
type ConfigLoadOptions struct {
CfgPaths []string
ConfigPaths []string
Props *p.Props
AllowEmpty bool
}
ConfigLoadOptions holds the options needed for loading configuration.
type FlagValues ¶
FlagValues holds the command-line flag values extracted from cobra command.
type OutdatedVersionOption ¶
type OutdatedVersionOption func(*outdatedVersionConfig)
OutdatedVersionOption configures handleOutdatedVersion behavior.
type UpdateCheckResult ¶
UpdateCheckResult holds the result of checking for updates.