common

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Text is the plain text format (table) representation of object(s)
	Text = "text"
	// YAML format is just yaml marshaled object(s)
	YAML = "yaml"
	// JSON format is just json marshaled object(s)
	JSON = "json"
)

Variables

This section is empty.

Functions

func AddBoolFlag

func AddBoolFlag(command *cobra.Command, key, flagName, flagShorthand string, defaultValue bool, env, usage string)

AddBoolFlag adds bool flag to provided cobra command and registers with provided env variable name

func AddDefaultFlags

func AddDefaultFlags(command *cobra.Command, envPrefix string)

AddDefaultFlags add all the flags that are needed by any aptomi CLI

func AddDurationFlag

func AddDurationFlag(command *cobra.Command, key, flagName, flagShorthand string, defaultValue time.Duration, env, usage string)

AddDurationFlag adds duration flag to provided cobra command and registers with provided env variable name

func AddStringFlag

func AddStringFlag(command *cobra.Command, key, flagName, flagShorthand, defaultValue, env, usage string)

AddStringFlag adds string flag to provided cobra command and registers with provided env variable name

func Format added in v0.1.2

func Format(output string, list bool, objs ...runtime.Displayable) ([]byte, error)

Format returns string format for provided objects based on the output config

func ReadConfig

func ReadConfig(viper *vp.Viper, cfg config.Base, defaultConfigDir string) error

ReadConfig reads configuration from CLI flags, default or specified file path into provided config object using the provided Viper instance and default configuration directory. It'll be checking if --config provided first and there are supported config file types in it if it's directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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