shared

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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

func ExplicitFlag(cmd *cobra.Command, flagName, viperKey string) string

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

func LoggerFromCmd(cmd *cobra.Command) (*slog.Logger, error)

LoggerFromCmd reuses the logger helper from create/shared.

func PrintJSON

func PrintJSON(doc interface{}) error

PrintJSON prints the resource as JSON.

func PrintTable

func PrintTable(cmd *cobra.Command, headers []string, rows [][]string)

PrintTable prints resources in a table format.

func PrintYAML

func PrintYAML(doc interface{}) error

PrintYAML prints the resource as YAML.

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.

Jump to

Keyboard shortcuts

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