Documentation
¶
Overview ¶
Package flags provides shared flag helpers for scafctl commands.
Index ¶
- func AddKvxOutputFlags(cmd *cobra.Command, outputFormat *string, interactive *bool, ...)
- func AddKvxOutputFlagsToStruct(cmd *cobra.Command, flags *KvxOutputFlags)
- func NewKvxOutputOptionsFromFlags(outputFormat string, interactive bool, expression string, ...) *kvx.OutputOptions
- func ToKvxOutputOptions(flags *KvxOutputFlags, opts ...kvx.OutputOption) *kvx.OutputOptions
- func ValidateKvxOutputFormat(format string) error
- type KvxOutputFlags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddKvxOutputFlags ¶
func AddKvxOutputFlags(cmd *cobra.Command, outputFormat *string, interactive *bool, expression *string)
AddKvxOutputFlags adds kvx-enabled output flags to a command. It sets up the standard -o/--output, -i/--interactive, and -e/--expression flags.
Parameters:
- cmd: The cobra command to add flags to
- outputFormat: Pointer to store the output format value (default: "table")
- interactive: Pointer to store the interactive mode value (default: false)
- expression: Pointer to store the CEL expression value (default: "")
func AddKvxOutputFlagsToStruct ¶
func AddKvxOutputFlagsToStruct(cmd *cobra.Command, flags *KvxOutputFlags)
AddKvxOutputFlagsToStruct adds kvx-enabled output flags to a command using a KvxOutputFlags struct. This is a convenience function when using the KvxOutputFlags struct directly.
func NewKvxOutputOptionsFromFlags ¶
func NewKvxOutputOptionsFromFlags( outputFormat string, interactive bool, expression string, opts ...kvx.OutputOption, ) *kvx.OutputOptions
NewKvxOutputOptionsFromFlags creates a new OutputOptions from command flags and options. This is a convenience function that combines flag parsing with functional options.
func ToKvxOutputOptions ¶
func ToKvxOutputOptions(flags *KvxOutputFlags, opts ...kvx.OutputOption) *kvx.OutputOptions
ToKvxOutputOptions converts flag values to OutputOptions for writing output. This creates a fully configured OutputOptions instance from flag values.
func ValidateKvxOutputFormat ¶
ValidateKvxOutputFormat validates the output format string. Returns an error if the format is not a valid output format.
Types ¶
type KvxOutputFlags ¶
type KvxOutputFlags struct {
// Output specifies the output format (table, json, yaml, quiet)
Output string `json:"output,omitempty" yaml:"output,omitempty" doc:"Output format" example:"table" maxLength:"10"`
// Interactive enables the kvx TUI for data exploration
Interactive bool `json:"interactive,omitempty" yaml:"interactive,omitempty" doc:"Launch interactive TUI mode"`
// Expression is a CEL expression to filter/transform output
Expression string `` /* 131-byte string literal not displayed */
}
KvxOutputFlags holds the flag values for kvx-enabled output. This struct is typically embedded in command options structs.