viper

package
v0.0.0-...-02c6b06 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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

func AddCustomConfigForFlag(f *pflag.Flag, key string)

AddCustomConfigForFlag sets a custom configuration key for the given flag

func BindPFlag

func BindPFlag(key string, f *flag.Flag)

BindPFlag binds a pflag to viper and stores a internal reference

func BindPFlagFromFlagSet

func BindPFlagFromFlagSet(fs *flag.FlagSet, name, key string)

BindPFlagFromFlagSet sets a custom configuration key for the given flag name

func GetConfigKey

func GetConfigKey(flag *pflag.Flag) string

func InitFlags

func InitFlags(fs *flag.FlagSet)

func ListAllCommandsFlags

func ListAllCommandsFlags(root *cobra.Command) []*pflag.FlagSet

func NewViperHelper

func NewViperHelper(v *viper.Viper, name string, configPaths ...string) *viperHelper

NewViperHelper creates a new global ViperHelper instance.

func PrefixConfigs

func PrefixConfigs(fs *pflag.FlagSet, prefix string, names ...string)

PrefixConfigs adds a prefix to all flags with the given names. config of "val" would then be "prefix.val"

func PrefixFlagSetConfigs

func PrefixFlagSetConfigs(fs *pflag.FlagSet, prefix string)

PrefixFlagSetConfigs adds a prefix to all flags of the flagset. config of "key" would then be "prefix.key"

func SetViper

func SetViper(helper *viperHelper)

Types

This section is empty.

Jump to

Keyboard shortcuts

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