printer

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintJson

func PrintJson(i interface{}, writer io.Writer) error

func PrintOutputJsonOrYaml

func PrintOutputJsonOrYaml(output string, i interface{}, writer io.Writer) (bool, error)

PrintOutputJsonOrYaml will print json or yaml to writer based on output value

func PrintTable

func PrintTable(columns []string, rows [][]string, writer io.Writer)

func PrintTableJsonPath

func PrintTableJsonPath(jsonStrings []string, columns []string, columnsPaths map[string]string, writer io.Writer)

PrintTableJsonPath will print a table with the supplied JSON data and map into the supplied Writer. The map contains the header and the json path to use access the value. The table printed will be something like: +---------------+---------------+ | COLUMN NAME 1 | COLUMN NAME 2 | +---------------+---------------+ | Some data 1 | Some data 1 | | Some data 2 | Some data 2 | +-------------------+-----------+ The function accepts a gjson query for columnsPaths instead of data, so it can query the each json string passed in

func PrintYaml

func PrintYaml(i interface{}, writer io.Writer) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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