Documentation ¶
Index ¶
- Constants
- Variables
- func AddCustomConfigForFlag(f *pflag.Flag, key string)
- func BindPFlag(key string, f *flag.Flag)
- func BindPFlagFromFlagSet(fs *flag.FlagSet, name, key string)
- func GetConfigKey(flag *pflag.Flag) string
- func InitFlags(fs *flag.FlagSet)
- func ListAllCommandsFlags(root *cobra.Command) []*pflag.FlagSet
- func NewViperHelper(v *viper.Viper, name string, configPaths ...string) *viperHelper
- func PrefixConfigs(fs *pflag.FlagSet, prefix string, names ...string)
- func PrefixFlagSetConfigs(fs *pflag.FlagSet, prefix string)
- func SetViper(helper *viperHelper)
Constants ¶
View Source
const (
KeyAnnotation = "key"
)
Variables ¶
View Source
var ViperHelper *viperHelper = NewViperHelper(nil, "config", fmt.Sprintf("$HOME/.%s", os.Args[0]))
Functions ¶
func AddCustomConfigForFlag ¶
AddCustomConfigForFlag sets a custom configuration key for the given flag
func BindPFlagFromFlagSet ¶
BindPFlagFromFlagSet sets a custom configuration key for the given flag name
func GetConfigKey ¶
func NewViperHelper ¶
NewViperHelper creates a new global ViperHelper instance.
func PrefixConfigs ¶
PrefixConfigs adds a prefix to all flags with the given names. config of "val" would then be "prefix.val"
func PrefixFlagSetConfigs ¶
PrefixFlagSetConfigs adds a prefix to all flags of the flagset. config of "key" would then be "prefix.key"
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.