command

package
v1.15.4 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOutputOption

func AddOutputOption(cmd *cobra.Command)

AddOutputOption adds the -o|--output option to any cmd to export to json or yaml.

func DumpJSONToString

func DumpJSONToString(data interface{}, jsonPath string) (string, error)

DumpJSONToString dumps the contents of data into a string. If jsonpath is non-empty, will attempt to do jsonpath filtering using said string. Returns a string containing the JSON in data, or an error if any JSON marshaling, parsing operations fail.

func ForceJSON

func ForceJSON()

ForceJSON sets output mode to JSON (for unit tests)

func GetStringMapString

func GetStringMapString(vp *viper.Viper, key string) map[string]string

GetStringMapString contains one enhancement to support k1=v2,k2=v2 compared to original implementation of GetStringMapString function Related upstream issue https://github.com/spf13/viper/issues/911

func GetStringMapStringE

func GetStringMapStringE(vp *viper.Viper, key string) (map[string]string, error)

GetStringMapStringE is same as GetStringMapString, but with error

func OutputOption

func OutputOption() bool

OutputOption returns true if an output option was specified.

func OutputOptionString

func OutputOptionString() string

OutputOptionString returns the output option as a string

func PrintOutput

func PrintOutput(data interface{}) error

PrintOutput receives an interface and dump the data using the --output flag. ATM only json or jsonpath. In the future yaml

func PrintOutputWithPatch

func PrintOutputWithPatch(data interface{}, patch interface{}) error

PrintOutputWithPatch merges data with patch and dump the data using the --output flag.

func PrintOutputWithType

func PrintOutputWithType(data interface{}, outputType string) error

PrintOutputWithType receives an interface and dump the data using the --output flag. ATM only json, yaml, or jsonpath.

func ToStringMapStringE

func ToStringMapStringE(data interface{}) (map[string]string, error)

ToStringMapStringE casts an interface to a map[string]string type. The underlying interface type might be a map or string. In the latter case, it is attempted to be json decoded, falling back to the k1=v2,k2=v2 format in case it doesn't look like json.

Types

This section is empty.

Directories

Path Synopsis
Package exec provides useful wrappers around the standard "exec" library.
Package exec provides useful wrappers around the standard "exec" library.

Jump to

Keyboard shortcuts

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