common

package
v0.0.0-...-e5adc05 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2017 License: BSD-3-Clause Imports: 6 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Format to use for output. One of 'json', 'yaml', 'pretty'
	Format string

	// Verbose ...
	Verbose bool
)

Functions

func Check

func Check(err error)

Check checks e and panic if not nil

func Exit

func Exit(format string, args ...interface{})

Exit func display an error message on stderr and exit 1

func FormatOutput

func FormatOutput(v interface{}, prettyFormatter func([]byte))

FormatOutput autmatically formats json based output based on user choice. when selected formatter is "pretty", call prettyFormatter callback.

func FormatOutputDef

func FormatOutputDef(v interface{})

FormatOutputDef autmatically formats json based output based on user choice. uses yamlFormatter as pretty formatter.

func FormatOutputError

func FormatOutputError(data []byte)

FormatOutputError prints the "message" field of an API return or falls back on FormatOutputDef if the field does not exist

func WrongUsage

func WrongUsage(cmd *cobra.Command)

WrongUsage display a wrong usage error, shows the help and exit 1

Types

This section is empty.

Jump to

Keyboard shortcuts

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