Documentation ¶
Index ¶
- Constants
- func AddBoolFlag(command *cobra.Command, key, flagName, flagShorthand string, defaultValue bool, ...)
- func AddDefaultFlags(command *cobra.Command, envPrefix string)
- func AddDurationFlag(command *cobra.Command, key, flagName, flagShorthand string, ...)
- func AddIntFlag(command *cobra.Command, key, flagName, flagShorthand string, defaultValue int, ...)
- func AddStringFlag(command *cobra.Command, ...)
- func Format(output string, list bool, objs ...runtime.Displayable) ([]byte, error)
- func ReadConfig(viper *vp.Viper, cfg config.Base, defaultConfigDir string) error
Constants ¶
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" )
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 ¶
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
Format returns string format for provided objects based on the output config
func ReadConfig ¶
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.