Documentation ¶
Overview ¶
Package cmd_config contains helper functions to support constructing Cobra commands, validating arguments and populating Viper config management
Index ¶
- Variables
- func BootstrapViper()
- func GetCloudMetadata() (*steampipeconfig.CloudMetadata, error)
- func SetViperDefaults(configMap map[string]interface{})
- func Viper() *viper.Viper
- type CmdBuilder
- func (c *CmdBuilder) AddBoolFlag(name, shorthand string, defaultValue bool, desc string, opts ...flagOpt) *CmdBuilder
- func (c *CmdBuilder) AddIntFlag(name, shorthand string, defaultValue int, desc string, opts ...flagOpt) *CmdBuilder
- func (c *CmdBuilder) AddStringArrayFlag(name, shorthand string, defaultValue []string, desc string, opts ...flagOpt) *CmdBuilder
- func (c *CmdBuilder) AddStringFlag(name string, shorthand string, defaultValue string, desc string, ...) *CmdBuilder
- func (c *CmdBuilder) AddStringMapStringFlag(name, shorthand string, defaultValue map[string]string, desc string, ...) *CmdBuilder
- func (c *CmdBuilder) AddStringSliceFlag(name, shorthand string, defaultValue []string, desc string, opts ...flagOpt) *CmdBuilder
Constants ¶
This section is empty.
Variables ¶
var FlagOptions = struct { Required func() flagOpt Hidden func() flagOpt Deprecated func(string) flagOpt }{ Required: requiredOpt, Hidden: hiddenOpt, Deprecated: deprecatedOpt, }
FlagOptions :: shortcut for common flag options
Functions ¶
func BootstrapViper ¶
func BootstrapViper()
BootstrapViper sets up viper with the essential path config (workspace-chdir and install-dir)
func GetCloudMetadata ¶
func GetCloudMetadata() (*steampipeconfig.CloudMetadata, error)
func SetViperDefaults ¶
func SetViperDefaults(configMap map[string]interface{})
SetViperDefaults sets up viper with default values for all config which is set via hcl config or env vars
Types ¶
type CmdBuilder ¶
type CmdBuilder struct {
// contains filtered or unexported fields
}
func OnCmd ¶
func OnCmd(cmd *cobra.Command) *CmdBuilder
OnCmd starts a config builder wrapping over the provided *cobra.Command
func (*CmdBuilder) AddBoolFlag ¶
func (c *CmdBuilder) AddBoolFlag(name, shorthand string, defaultValue bool, desc string, opts ...flagOpt) *CmdBuilder
AddBoolFlag ia s helper function to add a boolean flag to a command
func (*CmdBuilder) AddIntFlag ¶
func (c *CmdBuilder) AddIntFlag(name, shorthand string, defaultValue int, desc string, opts ...flagOpt) *CmdBuilder
AddIntFlag is a helper function to add an integer flag to a command
func (*CmdBuilder) AddStringArrayFlag ¶
func (c *CmdBuilder) AddStringArrayFlag(name, shorthand string, defaultValue []string, desc string, opts ...flagOpt) *CmdBuilder
AddStringArrayFlag is a helper function to add a flag that accepts an array of strings
func (*CmdBuilder) AddStringFlag ¶
func (c *CmdBuilder) AddStringFlag(name string, shorthand string, defaultValue string, desc string, opts ...flagOpt) *CmdBuilder
AddStringFlag is a helper function to add a string flag to a command
func (*CmdBuilder) AddStringMapStringFlag ¶
func (c *CmdBuilder) AddStringMapStringFlag(name, shorthand string, defaultValue map[string]string, desc string, opts ...flagOpt) *CmdBuilder
AddStringMapStringFlag is a helper function to add a flag that accepts a map of strings
func (*CmdBuilder) AddStringSliceFlag ¶
func (c *CmdBuilder) AddStringSliceFlag(name, shorthand string, defaultValue []string, desc string, opts ...flagOpt) *CmdBuilder
AddStringSliceFlag is a helper function to add a flag that accepts an array of strings