cli

package
v0.0.0-...-13b162e Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGoTemplate = "{{.}}"
View Source
const DefaultJSONPathTemplate = "{}"

Variables

View Source
var (
	InputFuncs = InputFuncMap{
		"json": JSONInput,
		"yaml": YAMLInput,
		"toml": TOMLInput,
		"hcl1": HCL1Input,
		"hcl2": HCL2Input,
		"hcl":  HCL2Input,
	}

	OutputFuncs = OutputFuncMap{
		"json":        JSONOutput,
		"yaml":        YAMLOutput,
		"toml":        TOMLOutput,
		"go-template": GoTemplateOutput,
		"jsonpath":    JSONPathOutput,
	}
)

Functions

func Execute

func Execute(version, commit, date, builtBy string)

Execute is the entrypoint command

func GoTemplateOutput

func GoTemplateOutput(v interface{}) ([]byte, error)

GoTemplateOutput renders a Go template. Supports Sprig and a few custom functions.

func HCL1Input

func HCL1Input(data []byte, v interface{}) error

func HCL2Input

func HCL2Input(b []byte, v interface{}) error

func Input

func Input(in []byte, format string) (interface{}, error)

Input decodes raw bytes into the specified format and returns an object.

func JSONInput

func JSONInput(data []byte, v interface{}) error

func JSONOutput

func JSONOutput(v interface{}) ([]byte, error)

func JSONPathOutput

func JSONPathOutput(v interface{}) ([]byte, error)

JSONPathOutput renders a JSONPath template given in Kubernetes CLI format. More information: https://kubernetes.io/docs/reference/kubectl/jsonpath/ TODO: https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/kubectl/pkg/cmd/get/customcolumn.go

func Output

func Output(obj interface{}, format string) ([]byte, error)

Output encodes an object into the specified format and returns raw bytes.

func TOMLInput

func TOMLInput(data []byte, v interface{}) error

func TOMLOutput

func TOMLOutput(v interface{}) ([]byte, error)

func YAMLInput

func YAMLInput(data []byte, v interface{}) error

func YAMLOutput

func YAMLOutput(v interface{}) ([]byte, error)

Types

type InputFuncMap

type InputFuncMap map[string]func([]byte, interface{}) error

func (*InputFuncMap) Options

func (m *InputFuncMap) Options() string

type OutputFuncMap

type OutputFuncMap map[string]func(v interface{}) ([]byte, error)

func (*OutputFuncMap) Options

func (m *OutputFuncMap) Options() string

Jump to

Keyboard shortcuts

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