is a Go package that
exposes environment variables for all the flags within
It came out of a response to a
about their envy package.
This package differs from that one in several ways:
the usage is slightly different, it is not a drop in replacement
it can be used with any flag.FlagSet, not just flag.CommandLine
it tries harder (compared to the original envy) to avoid effecting
the reported argument defaults or the results of functions/methods such as
flag.Visit and flag.NFlag
if there are any errors parsing environment variables (e.g. a string value where
an interger value is expected) the first such encountered is returned
for complete examples but basically you can just replace the call to:
to have envirment variables such as PROGNAME_PORT be used for
the program’s -port argument when no such argument is provided.
This package is Copyright 2017, Dave Chapeskie.
You are free to do with it anything you want, with the sole exception
being you cannot replicate this package and claim you wrote it.