vcflag

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindEnvVarsToFlags

func BindEnvVarsToFlags(
	viperObj *viper.Viper, cmd *cobra.Command,
	envPrefix string,
	logger *logr.Logger,
)

Init the config reader via Viper and Cobra objects. we can specify either the config file name, or the config name, and its type as well as the locations to find that config files

func GenerateFlags

func GenerateFlags(value interface{}, viperObj *viper.Viper, command *cobra.Command) error

GenerateFlags creates flags based on the attributes of object `value` and bind them to viper this function should be called when initialize cobra command return error in case these is any issue when generating flags for CLI

func InitConfigReader

func InitConfigReader(
	viperObj *viper.Viper, cmd *cobra.Command,
	cfgFile string, cfgName string, cfgType string, configLocations []string,
	envPrefix string,
	logger *logr.Logger,
	autoBindEnvVarsToFlags bool,
) error

Init the config reader via Viper and Cobra objects. we can specify either the config file name, or the config name, and its type as well as the locations to find that config files if autoBindEnvVarsToFlags is true, the environment variables are bind automatically to the pflags name of the env vars is based on the struct

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL