Documentation
¶
Index ¶
- Constants
- Variables
- func AllowExtraOutputFormats(cmd *cobra.Command, formats ...string)
- func AllowedOutputFormats(cmd *cobra.Command) []string
- func IsOutputFormatValidationSkipped(cmd *cobra.Command) bool
- func SkipOutputFormatValidation(cmd *cobra.Command)
- func ValidateOutputFormat(cmd *cobra.Command, value string) error
- type ColorMode
- type LogLevel
- type OutputFormat
Constants ¶
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 )
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).
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 ¶
var BaseOutputFormats = []string{"json", "yaml", "text"}
BaseOutputFormats are the --output values accepted by every command.
Functions ¶
func AllowExtraOutputFormats ¶ added in v1.0.0
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
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
IsOutputFormatValidationSkipped reports whether cmd or any of its ancestors has opted out of root-level --output validation.
func SkipOutputFormatValidation ¶ added in v1.0.0
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
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 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