Documentation
¶
Index ¶
- func Description(appName string, opts config.Options) string
- func KeyRemappingHook(aliasToPathMap map[string]string, defaultsMap map[string]string) mapstructure.DecodeHookFunc
- func Merge(globalSettings map[string]any, c *cobra.Command) map[string]any
- func SetupConfig(vip *viper.Viper, configFile string, appName string, opts config.Options)
- func SyncMandatoryFlags(c *cobra.Command, T reflect.Type, vip *viper.Viper, structPath string)
- func ValidateKeys(configValues map[string]any, opts any, hooks ...mapstructure.DecodeHookFunc) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Description ¶
Description creates a description based on the search paths
func KeyRemappingHook ¶
func KeyRemappingHook(aliasToPathMap map[string]string, defaultsMap map[string]string) mapstructure.DecodeHookFunc
KeyRemappingHook allows config keys to match either a field's name or its `flag` tag.
It correctly handles flattened keys that point to nested struct fields.
func Merge ¶
Merge creates a configuration map for a specific command.
It merges the top-level settings with command-specific settings (which can be nested) from the global configuration.
func SetupConfig ¶
SetupConfig handles the viper initialization
func SyncMandatoryFlags ¶
SyncMandatoryFlags tells cobra that a required flag is present when its value is provided by a source other than the command line (e.g., config file).
func ValidateKeys ¶ added in v0.10.0
func ValidateKeys(configValues map[string]any, opts any, hooks ...mapstructure.DecodeHookFunc) error
ValidateKeys decodes command-relevant config values into opts' shape and fails when unknown keys are present.
Types ¶
This section is empty.