common

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultAPISchema is a default API schema
	DefaultAPISchema = "http"
	// DefaultAPIHost is a default API host
	DefaultAPIHost = "127.0.0.1"
	// DefaultAPIPort is a default API port
	DefaultAPIPort = 27866
	// DefaultAPIPrefix is a default API prefix
	DefaultAPIPrefix = "api/v1"
)
View Source
const (
	// Default is the default format
	Default = Text
	// 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 AddIntFlag added in v0.1.15

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

AddIntFlag adds int 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