package
Version:
v0.0.0-...-a142011
Opens a new window with list of versions in this module.
Published: Dec 18, 2024
License: Apache-2.0
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
Documentation
¶
-
func AdditionalEnv(fs *pflag.FlagSet, flagName, envName string)
-
func Bind[T Flaggable](fs *pflag.FlagSet, name, shorthand, usage string, val *T)
-
func BindEnv[T Flaggable](fs *pflag.FlagSet, name, shorthand, usage string, val *T)
-
type Flaggable
AdditionalEnv allows additional env vars to set the flag value as well.
Unlike BindEnv, this does not do any transformations.
Bind registers a flag to the FlagSet. When parsed, the value will be set via pointer.
Usage:
cfg := Config{Foo: "default-foo"}
flag.Bind(fs, "foo", "f", "the foo value", &cfg.Foo)
BindEnv behaves like Bind, but additionally allows an environment variable to override.
This will transform to name field: foo-bar becomes FOO_BAR.
Flaggable defines the set of types that can be flags.
This is not exhaustive; add more as needed
Source Files
¶
Click to show internal directories.
Click to hide internal directories.