Documentation ¶
Index ¶
- Constants
- Variables
- 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 AddStringFlag(command *cobra.Command, ...)
- func Format(cfg *config.Client, list bool, objs ...runtime.Displayable) ([]byte, error)
- func ReadConfig(viper *vp.Viper, cfg config.Base, defaultConfigDir string) error
Constants ¶
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 ¶
var Version = &cobra.Command{ Use: "version", Short: "Print the Aptomi Client version", Run: func(cmd *cobra.Command, args []string) { info := version.GetBuildInfo() fmt.Printf("Aptomi Client version: %s\n git commit: %s\n built: %s\n", info.GitVersion, info.GitCommit, info.BuildDate) }, }
Version is the instance of cobra command that shows version from version package (injected at build tome)
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 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.