testutil

package
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateCommandExamples

func ValidateCommandExamples(rootCmd *cobra.Command, example string) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL