Documentation ¶
Index ¶
- func AddOutputOption(cmd *cobra.Command)
- func DumpJSONToString(data interface{}, jsonPath string) (string, error)
- func ForceJSON()
- func GetStringMapString(vp *viper.Viper, key string) map[string]string
- func GetStringMapStringE(vp *viper.Viper, key string) (map[string]string, error)
- func OutputOption() bool
- func OutputOptionString() string
- func PrintOutput(data interface{}) error
- func PrintOutputWithPatch(data interface{}, patch interface{}) error
- func PrintOutputWithType(data interface{}, outputType string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOutputOption ¶ added in v1.14.0
AddOutputOption adds the -o|--output option to any cmd to export to json or yaml.
func DumpJSONToString ¶ added in v1.14.0
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 ¶ added in v1.14.0
func ForceJSON()
ForceJSON sets output mode to JSON (for unit tests)
func GetStringMapString ¶ added in v1.14.0
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 ¶ added in v1.14.0
GetStringMapStringE is same as GetStringMapString, but with error
func OutputOption ¶ added in v1.14.0
func OutputOption() bool
OutputOption returns true if an output option was specified.
func OutputOptionString ¶ added in v1.14.0
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 ¶ added in v1.14.0
func PrintOutputWithPatch(data interface{}, patch interface{}) error
PrintOutputWithPatch merges data with patch and dump the data using the --output flag.
func PrintOutputWithType ¶
PrintOutputWithType receives an interface and dump the data using the --output flag. ATM only json, yaml, or jsonpath.
Types ¶
This section is empty.