Documentation
¶
Overview ¶
Package cli provides a thin generic cobra scaffold for building CLI entry points: a root command with common flags (--version, --config) and a subcommand registration helper. No application-specific defaults are baked in — all parameters are supplied by the caller.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRoot ¶
func NewRoot(cfg RootConfig) *cobra.Command
NewRoot builds a generic cobra root command with --version (when Version is set) and a --config flag, ready to have subcommands attached.
func PrintMCPConfig ¶
func PrintMCPConfig(name, url, transport string)
PrintMCPConfig prints a 'claude mcp add' config snippet for the given server name, url and transport to stdout.
func RegisterSubcommand ¶
func RegisterSubcommand(root *cobra.Command, sub SubcommandConfig) *cobra.Command
RegisterSubcommand attaches a subcommand described by sub to root and returns the created command so callers can add flags to it.
Types ¶
type RootConfig ¶
type RootConfig struct {
Use string // command usage line, e.g. "myapp"
Short string // one-line description
Long string // long description
Version string // value reported by --version; empty disables the flag
// ConfigFlagName is the name of the config-file flag; defaults to "config".
ConfigFlagName string
// Run is the root command's Run function; may be nil for command groups.
Run func(cmd *cobra.Command, args []string)
}
RootConfig holds parameters for building the root command. All fields are optional except Use.