cmd

package
v0.0.0-...-7523913 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute executes the root command

Types

type OutputFormatter

type OutputFormatter func(object interface{}) string

OutputFormatter declares the function signature for formatting output

var ConsoleOutputFormatter OutputFormatter

ConsoleOutputFormatter determines how output data will be formatted A nil value will print human readable output, all other values will print computer output

var JSONFormatter OutputFormatter = func(object interface{}) string {
	buf := bytes.Buffer{}

	jsonEncoder := json.NewEncoder(&buf)
	jsonEncoder.SetIndent("", "    ")
	jsonEncoder.Encode(object)

	return buf.String()
}

JSONFormatter formats all values as json

Jump to

Keyboard shortcuts

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