cmdutil

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssumeYes

func AssumeYes(cmd *cobra.Command) bool

AssumeYes returns true when prompts should be skipped.

func ClientFromCommand

func ClientFromCommand(cmd *cobra.Command) (*client.Client, error)

ClientFromCommand returns a configured authenticated client for the command.

func Confirm

func Confirm(cmd *cobra.Command, prompt string) (bool, error)

Confirm prompts the user unless --yes is enabled.

func DecodeJSON

func DecodeJSON[T any](resp *http.Response, out *T) error

DecodeJSON decodes JSON into out and enforces a successful HTTP status.

func EffectiveLimit

func EffectiveLimit(cmd *cobra.Command, resource, flagName string, flagValue, fallbackDefault int) int

EffectiveLimit resolves the final list limit with precedence: explicit flag > per-resource config > global config > fallback default.

func EnsureSuccessStatus

func EnsureSuccessStatus(resp *http.Response) error

EnsureSuccessStatus returns an error for non-2xx responses.

func JSONOutputEnabled

func JSONOutputEnabled(cmd *cobra.Command) bool

JSONOutputEnabled returns true if JSON output is enabled for this command.

func ParseResourceLimit

func ParseResourceLimit(pair string) (resource string, limit int, ok bool)

ParseResourceLimit parses a "resource=limit" pair.

func PrintJSON

func PrintJSON(v any) error

PrintJSON prints indented JSON to stdout.

func ResolveOutputMode

func ResolveOutputMode(mode string) (runtimectx.OutputMode, error)

ResolveOutputMode validates a free-form output mode value.

func UnauthClientFromCommand

func UnauthClientFromCommand(cmd *cobra.Command) (*client.Client, error)

UnauthClientFromCommand returns a configured unauthenticated client for the command.

Types

type HTTPStatusError

type HTTPStatusError struct {
	StatusCode int
	Body       string
}

HTTPStatusError represents a non-2xx HTTP response.

func (*HTTPStatusError) Error

func (e *HTTPStatusError) Error() string

Jump to

Keyboard shortcuts

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