Documentation ¶
Overview ¶
Package basicflag implements a koanf.Provider that reads commandline parameters as conf maps using the Go's flag package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pflag ¶
type Pflag struct {
// contains filtered or unexported fields
}
Pflag implements a pflag command line provider.
func Provider ¶
Provider returns a commandline flags provider that returns a nested map[string]interface{} of environment variable where the nesting hierarchy of keys are defined by delim. For instance, the delim "." will convert the key `parent.child.key: 1` to `{parent: {child: {key: 1}}}`.
func ProviderWithValue ¶ added in v0.16.0
func ProviderWithValue(f *flag.FlagSet, delim string, cb func(key string, value string) (string, interface{})) *Pflag
ProviderWithValue works exactly the same as Provider except the callback takes a (key, value) with the variable name and value and allows you to modify both. This is useful for cases where you may want to return other types like a string slice instead of just a string.