Documentation
¶
Overview ¶
Package cmdinfo collects structured information about CLI commands for kvx-powered discovery and exploration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommandDetail ¶ added in v0.11.0
type CommandDetail struct {
Name string `json:"name" yaml:"name" doc:"Full command path"`
Short string `json:"short" yaml:"short" doc:"Short description"`
Long string `json:"long,omitempty" yaml:"long,omitempty" doc:"Long description"`
Usage string `json:"usage" yaml:"usage" doc:"Usage string"`
Examples string `json:"examples,omitempty" yaml:"examples,omitempty" doc:"Example invocations"`
Aliases []string `json:"aliases,omitempty" yaml:"aliases,omitempty" doc:"Command aliases"`
Flags []FlagInfo `json:"flags,omitempty" yaml:"flags,omitempty" doc:"Available flags"`
Subcommands []string `json:"subcommands,omitempty" yaml:"subcommands,omitempty" doc:"Child command names"`
Deprecated string `json:"deprecated,omitempty" yaml:"deprecated,omitempty" doc:"Deprecation message"`
}
CommandDetail holds full structured help for a single CLI command, including flags, usage, and examples.
func GetCommandDetail ¶ added in v0.11.0
func GetCommandDetail(cmd *cobra.Command) CommandDetail
GetCommandDetail returns structured help for a single command.
type CommandInfo ¶
type CommandInfo struct {
Name string `json:"name" yaml:"name" doc:"Full command path including root" maxLength:"256" example:"mycli run solution"`
Short string `json:"short" yaml:"short" doc:"Short description" maxLength:"512" example:"Run a solution workflow"`
Group string `json:"group" yaml:"group" doc:"Command group" maxLength:"64" example:"core"`
Aliases []string `json:"aliases,omitempty" yaml:"aliases,omitempty" doc:"Command aliases" maxItems:"10"`
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty" doc:"Whether the command is deprecated"`
HasChildren bool `json:"hasChildren,omitempty" yaml:"hasChildren,omitempty" doc:"Whether the command has subcommands"`
FlagCount int `json:"flagCount" yaml:"flagCount" doc:"Number of flags" minimum:"0" maximum:"1000" example:"8"`
}
CommandInfo holds structured metadata about a single CLI command.
func CollectCommands ¶
func CollectCommands(root *cobra.Command, leafOnly bool) []CommandInfo
CollectCommands walks a Cobra command tree and returns structured info about all available commands. If leafOnly is true, only commands without children are returned (the actionable commands).
type FlagInfo ¶ added in v0.11.0
type FlagInfo struct {
Name string `json:"name" yaml:"name" doc:"Flag name (without --)"`
Shorthand string `json:"shorthand,omitempty" yaml:"shorthand,omitempty" doc:"Single-letter shorthand"`
Type string `json:"type" yaml:"type" doc:"Value type" example:"string"`
Default string `json:"default,omitempty" yaml:"default,omitempty" doc:"Default value"`
Description string `json:"description" yaml:"description" doc:"Flag description"`
Required bool `json:"required,omitempty" yaml:"required,omitempty" doc:"Whether the flag is required"`
}
FlagInfo holds structured metadata about a single CLI flag.
Click to show internal directories.
Click to hide internal directories.