cmd

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitFailure   = 1
	ExitCancelled = 2
	ExitTimeout   = 124
)

Variables

View Source
var (
	Version = "dev"

	NoColor bool
	Quiet   bool
	Verbose bool
	NoInput bool
)
View Source
var GetClientFunc = defaultGetClient

GetClientFunc is the function used to create API clients. It can be overridden in tests to inject mock clients.

Functions

func AddJSONFieldsFlag

func AddJSONFieldsFlag(cmd *cobra.Command, target *string)

AddJSONFieldsFlag adds a --json flag that accepts optional field specification

func Execute

func Execute() error

Types

type ExitError added in v0.4.0

type ExitError struct {
	Code int
}

ExitError is returned by commands that need a specific exit code.

func (*ExitError) Error added in v0.4.0

func (e *ExitError) Error() string

type JSONFieldsResult

type JSONFieldsResult struct {
	Enabled bool
	Fields  []string
}

JSONFieldsResult represents the parsed result of --json flag

func ParseJSONFields

func ParseJSONFields(cmd *cobra.Command, flagValue string, spec *api.FieldSpec) (JSONFieldsResult, bool, error)

ParseJSONFields parses the --json flag value, returns (result, showHelp, error).

type RootCommand

type RootCommand = cobra.Command

RootCommand is an alias for cobra.Command for external access

func GetRootCmd

func GetRootCmd() *RootCommand

GetRootCmd returns the root command for testing

func NewRootCmd

func NewRootCmd() *RootCommand

NewRootCmd creates a fresh root command instance for testing. This ensures tests don't share flag state from previous test runs.

Jump to

Keyboard shortcuts

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