diff options
| author | Felix Hanley <felix@userspace.com.au> | 2026-01-13 22:46:25 +0000 |
|---|---|---|
| committer | Felix Hanley <felix@userspace.com.au> | 2026-01-13 22:46:25 +0000 |
| commit | 3316d2ebc77cef2c2bd03869063910bd8453d704 (patch) | |
| tree | 83d45db99a68f7d6e11c16d2cadf31612f2fe892 /flag.go | |
| parent | 87e4f8cc1cc88929700d0fd01d142816ff3c15c6 (diff) | |
| download | envflag-3316d2ebc77cef2c2bd03869063910bd8453d704.tar.gz envflag-3316d2ebc77cef2c2bd03869063910bd8453d704.tar.bz2 | |
Diffstat (limited to 'flag.go')
| -rw-r--r-- | flag.go | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -20,7 +20,7 @@ type UsageUpdaterFunc func(key, usage string) string type config struct { prefix string - getenv func(string) string + getenv func(string) string flagConverter FlagConverterFunc usageUpdater UsageUpdaterFunc } @@ -55,6 +55,12 @@ func UsageUpdater(f UsageUpdaterFunc) Option { } // UsagePrefixer prefixes the flag usage with [envvar]. +// +// Example output: +// +// Usage of example: +// -verbose +// [VERBOSE] Be verbose func UsagePrefixer() Option { return func(cfg *config) { cfg.usageUpdater = usagePrefixer @@ -62,6 +68,12 @@ func UsagePrefixer() Option { } // UsageSuffixer suffixes the flag usage with [envvar]. +// +// Example output: +// +// Usage of example: +// -verbose +// Be verbose [VERBOSE] func UsageSuffixer() Option { return func(cfg *config) { cfg.usageUpdater = usageSuffixer @@ -88,7 +100,7 @@ func parseFlagSetWithEnv(fs *flag.FlagSet, arguments []string, opts ...Option) e } cfg := &config{ flagConverter: flagToEnv(), - getenv: os.Getenv, + getenv: os.Getenv, } for _, o := range opts { o(cfg) |
