MCPcopy
hub / github.com/spf13/viper / BindPFlag

Method BindPFlag

viper.go:1074–1079  ·  view source on GitHub ↗
(key string, flag *pflag.Flag)

Source from the content-addressed store, hash-verified

1072func BindPFlag(key string, flag *pflag.Flag) error { return v.BindPFlag(key, flag) }
1073
1074func (v *Viper) BindPFlag(key string, flag *pflag.Flag) error {
1075 if flag == nil {
1076 return fmt.Errorf("flag for %q is nil", key)
1077 }
1078 return v.BindFlagValue(key, pflagValue{flag})
1079}
1080
1081// BindFlagValues binds a full FlagValue set to the configuration, using each flag's long
1082// name as the config key.

Callers 5

TestBindPFlagFunction · 0.80
TestBoundCaseSensitivityFunction · 0.80
TestIsSetFunction · 0.80
BindPFlagFunction · 0.80

Calls 1

BindFlagValueMethod · 0.95

Tested by 4

TestBindPFlagFunction · 0.64
TestBoundCaseSensitivityFunction · 0.64
TestIsSetFunction · 0.64