output

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: Apache-2.0 Imports: 10 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalToJson added in v1.21.1

func MarshalToJson(input interface{}) ([]byte, error)

func MarshalToYaml added in v1.21.1

func MarshalToYaml(input interface{}) ([]byte, error)

Types

type ColorizeUi added in v1.21.1

type ColorizeUi struct {
	Colorize       *colorstring.Colorize
	OutputColor    string
	InfoColor      string
	ErrorColor     string
	WarnColor      string
	SuccessColor   string
	Ui             cli.Ui
	Quiet          bool
	OutputFormater OutputFormater
}

func NewUI added in v1.21.1

func NewUI(
	quiet, color bool,
	outputFormater OutputFormater,
	outWriter, errWriter io.Writer,
) *ColorizeUi

func (*ColorizeUi) Ask added in v1.21.1

func (u *ColorizeUi) Ask(query string) (string, error)

func (*ColorizeUi) AskSecret added in v1.21.1

func (u *ColorizeUi) AskSecret(query string) (string, error)

func (*ColorizeUi) Error added in v1.21.1

func (u *ColorizeUi) Error(message string)

func (*ColorizeUi) Info added in v1.21.1

func (u *ColorizeUi) Info(message string)

func (*ColorizeUi) JsonOutput added in v1.21.1

func (u *ColorizeUi) JsonOutput(data interface{})

JsonOutput prints the data specified using the configured OutputFormater.

func (*ColorizeUi) Output added in v1.21.1

func (u *ColorizeUi) Output(message string)

func (*ColorizeUi) Success added in v1.21.1

func (u *ColorizeUi) Success(message string)

func (*ColorizeUi) Warn added in v1.21.1

func (u *ColorizeUi) Warn(message string)

type OutputFormater added in v1.21.1

type OutputFormater func(interface{}) ([]byte, error)

func MarshalToJsonPathWrapper added in v1.21.1

func MarshalToJsonPathWrapper(expression string) OutputFormater

MarshalToJsonPathWrapper returns a MarshalToJsonPath function that uses the specified jsonpath expression. This leverages the kubernetes jsonpath library (https://kubernetes.io/docs/reference/kubectl/jsonpath/).

func ParseOutputFormat

func ParseOutputFormat(outputFormat string) (OutputFormater, error)

ParseOutputFormat returns an OutputFormater based on the specified format. Accepted values include 'json', 'yaml', and 'jsonpath=PATH'. Empty string defaults to 'json'. For more about JSONPath, see https://goessner.net/articles/JsonPath/

type Ui added in v1.21.1

type Ui interface {
	Success(message string)
	JsonOutput(data interface{})
	cli.Ui
}

Jump to

Keyboard shortcuts

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