Documentation
¶
Index ¶
- func ControllerFromCmd(cmd *cobra.Command) (*controller.Exec, error)
- func ExplicitFlag(cmd *cobra.Command, flagName, viperKey string) string
- func FormatControllers(controllers []string) string
- func LoggerFromCmd(cmd *cobra.Command) (*slog.Logger, error)
- func PrintJSON(doc interface{}) error
- func PrintTable(cmd *cobra.Command, headers []string, rows [][]string)
- func PrintYAML(doc interface{}) error
- type OutputFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ControllerFromCmd ¶
func ControllerFromCmd(cmd *cobra.Command) (*controller.Exec, error)
ControllerFromCmd reuses the controller helper from create/shared.
func ExplicitFlag ¶ added in v0.2.0
ExplicitFlag returns the flag's value only when the user explicitly provided it. This avoids viper.SetDefault side-effects leaking hardcoded defaults (e.g. "default") into list-operation filters, where an unset flag must mean "no filter".
func FormatControllers ¶ added in v0.4.0
FormatControllers renders a Status.SubtreeControllers slice for the CONTROLLERS table column emitted by `kuke get <kind> --show-controllers` (issue #328). Empty input renders as "-" so the column never collapses to an unaligned blank cell.
func LoggerFromCmd ¶
LoggerFromCmd reuses the logger helper from create/shared.
func PrintTable ¶
PrintTable prints resources in a table format.
Types ¶
type OutputFormat ¶
type OutputFormat string
OutputFormat represents the output format type.
const ( OutputFormatYAML OutputFormat = "yaml" OutputFormatJSON OutputFormat = "json" OutputFormatTable OutputFormat = "table" )
func ParseOutputFormat ¶
func ParseOutputFormat(cmd *cobra.Command) (OutputFormat, error)
ParseOutputFormat resolves the output format using kuke's standard precedence: explicit `--output`/`-o` flag > KUKEON_GET_OUTPUT env (and any other source viper has bound to `kuke/get/output`) > table default. Each `kuke get <kind>` subcommand binds its own `--output` flag to the shared viper key at construction time, but viper only retains the last binding for a given key; reading the active command's flag directly keeps the flag working for every subcommand and lets viper handle the env/config fall-throughs.