Documentation ¶
Overview ¶
Package posflag implements a koanf.Provider that reads commandline parameters as conf maps using spf13/pflag, a POSIX compliant alternative to Go's stdlib flag package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Posflag ¶
type Posflag struct {
// contains filtered or unexported fields
}
Posflag 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}}}`.
It takes an optional (but recommended) Koanf instance to see if the the flags defined have been set from other providers, for instance, a config file. If they are not, then the default values of the flags are merged. If they do exist, the flag values are not merged but only the values that have been explicitly set in the command line are merged.