common

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// related to the --output flag
	DefaultOutputFormat = "text"
	OutputFlagName      = "output"
	OutputFlagShort     = "o"
	OutputConfigPath    = OutputFlagName

	// related to the --color flag
	ColorFlagName    = "color"
	ColorConfigPath  = ColorFlagName
	DefaultColorMode = "auto"

	// related to the --color-theme flag
	ColorThemeFlagName   = "color-theme"
	ColorThemeConfigPath = "color-theme"
	DefaultColorTheme    = "auto"

	// related to the --profile flag
	ProfileFlagName  = "profile"
	ProfileFlagShort = "p"

	// related to the --config-file flag
	ConfigFilePathFlagName = "config-file"

	// related to the --log-level flag
	LogLevelFlagName   = "log-level"
	DefaultLogLevel    = "info"
	LogLevelConfigPath = LogLevelFlagName

	// related to directing logs to a file
	LogFileFlagName   = "log-file"
	LogFileConfigPath = LogFileFlagName

	// related to profile-wide HTTP client defaults
	HTTPTimeoutFlagName                     = "http-timeout"
	HTTPTimeoutConfigPath                   = HTTPTimeoutFlagName
	HTTPTCPUserTimeoutName                  = "http-tcp-user-timeout"
	HTTPTCPUserTimeoutConfigPath            = HTTPTCPUserTimeoutName
	HTTPDisableKeepAlivesName               = "http-disable-keepalives"
	HTTPDisableKeepAlivesConfigPath         = HTTPDisableKeepAlivesName
	HTTPRecycleConnectionsOnErrorName       = "http-recycle-connections-on-error"
	HTTPRecycleConnectionsOnErrorConfigPath = HTTPRecycleConnectionsOnErrorName

	// related to retry/backoff for HTTP requests
	HTTPRetryMaxAttemptsFlagName          = "http-retry-max-attempts"
	HTTPRetryMaxAttemptsConfigPath        = HTTPRetryMaxAttemptsFlagName
	HTTPRetryInitialIntervalFlagName      = "http-retry-initial-interval"
	HTTPRetryInitialIntervalConfigPath    = HTTPRetryInitialIntervalFlagName
	HTTPRetryMaxIntervalFlagName          = "http-retry-max-interval"
	HTTPRetryMaxIntervalConfigPath        = HTTPRetryMaxIntervalFlagName
	HTTPRetryBackoffFactorFlagName        = "http-retry-backoff-factor"
	HTTPRetryBackoffFactorConfigPath      = HTTPRetryBackoffFactorFlagName
	HTTPRetryOnConnectionErrorsFlagName   = "http-retry-on-connection-errors"
	HTTPRetryOnConnectionErrorsConfigPath = HTTPRetryOnConnectionErrorsFlagName
)
View Source
const ExtraOutputFormatsAnnotation = "kongctl.output.extra-formats"

ExtraOutputFormatsAnnotation is the cobra command-annotation key listing extra --output values (comma-separated) that a command opts into beyond the base set (json/yaml/text).

View Source
const SkipOutputFormatValidationAnnotation = "kongctl.output.skip-validation"

SkipOutputFormatValidationAnnotation marks a command (or its subtree) as performing its own --output handling. When set, the root-level output-format validator skips the command so the command's own (often more actionable) error message can surface instead.

Variables

View Source
var BaseOutputFormats = []string{"json", "yaml", "text"}

BaseOutputFormats are the --output values accepted by every command.

Functions

func AllowExtraOutputFormats added in v1.0.0

func AllowExtraOutputFormats(cmd *cobra.Command, formats ...string)

AllowExtraOutputFormats marks cobraCmd as accepting these additional --output values beyond the base set. Values are stored as a comma-separated list in the command's Annotations under ExtraOutputFormatsAnnotation and are merged with any previously-declared extras.

func AllowedOutputFormats added in v1.0.0

func AllowedOutputFormats(cmd *cobra.Command) []string

AllowedOutputFormats returns the full list of --output values accepted by cmd: the base set plus any extras declared via AllowExtraOutputFormats on cmd itself or any of its ancestors.

func IsOutputFormatValidationSkipped added in v1.0.0

func IsOutputFormatValidationSkipped(cmd *cobra.Command) bool

IsOutputFormatValidationSkipped reports whether cmd or any of its ancestors has opted out of root-level --output validation.

func SkipOutputFormatValidation added in v1.0.0

func SkipOutputFormatValidation(cmd *cobra.Command)

SkipOutputFormatValidation marks cmd (and its descendants) as opting out of root-level --output validation. Use this for commands that do their own flag handling (e.g. plan, scaffold) so they can surface command-specific error messages instead of the generic "invalid value" error.

func ValidateOutputFormat added in v1.0.0

func ValidateOutputFormat(cmd *cobra.Command, value string) error

ValidateOutputFormat returns nil if value is in the base set or in the extras declared on cmd or one of its ancestors. Commands that have opted out via SkipOutputFormatValidation are always considered valid here.

Types

type ColorMode added in v0.1.6

type ColorMode int
const (
	ColorModeAuto ColorMode = iota
	ColorModeAlways
	ColorModeNever
)

func ColorModeStringToIota added in v0.1.6

func ColorModeStringToIota(mode string) (ColorMode, error)

func (ColorMode) String added in v0.1.6

func (cm ColorMode) String() string

type LogLevel

type LogLevel int
const (
	TRACE LogLevel = iota
	DEBUG
	INFO
	WARN
	ERROR
)

func LogLevelStringToIota

func LogLevelStringToIota(level string) (LogLevel, error)

func (LogLevel) String

func (ll LogLevel) String() string

type OutputFormat

type OutputFormat int

Represents an enum of valid values for the format of the output for this CLI execution

const (
	JSON OutputFormat = iota
	YAML
	TEXT
	HELM
)

func OutputFormatStringToIota

func OutputFormatStringToIota(format string) (OutputFormat, error)

func (OutputFormat) String

func (of OutputFormat) String() string

Jump to

Keyboard shortcuts

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