Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateCommandExamples ¶
ValidateCommandExamples combines parsing and validation
func ValidateExampleCommand ¶
func ValidateExampleCommand(rootCmd *cobra.Command, exampleCmd ExampleCommand) error
ValidateExampleCommand verifies command exists and flags are valid - Uses Cobra's Find() to locate command in tree - Checks both command-specific and persistent flags
Types ¶
type ExampleCommand ¶
type ExampleCommand struct {
Raw string // Original command line
Binary string // Binary name (should be "kdn")
Args []string // Subcommands and positional arguments
FlagPresent map[string]bool // Flags that were present in the command
FlagValues map[string]string // Values for flags (empty string if no value provided)
Flags map[string]string // Deprecated: use FlagPresent and FlagValues instead
EnvVars map[string]string // Environment variable assignments that preceded the command
}
ExampleCommand represents a parsed command from an Example string
func ParseExampleCommands ¶
func ParseExampleCommands(example string) ([]ExampleCommand, error)
ParseExampleCommands extracts kdn commands from Example string - Ignores empty lines and comment lines (starting with #) - Lines may be prefixed with VAR=VALUE environment variable assignments - Returns error if non-comment lines do not contain a kdn command
Click to show internal directories.
Click to hide internal directories.