Documentation
¶
Index ¶
- func ControllerFromCmd(cmd *cobra.Command) (*controller.Exec, error)
- func ExplicitFlag(cmd *cobra.Command, flagName, viperKey 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 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 parses and validates the --output flag from the command.
Click to show internal directories.
Click to hide internal directories.