Documentation
¶
Overview ¶
Package goflenfig is a simple flag and config package that is a semi-drop-in replacement (only `StringVars` is currently implemented) for the standard `flag` package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolVar ¶ added in v0.5.0
BoolVar defines an boolean flag with specified name, default value, and usage string. The argument p points to an bool variable in which to store the value of the flag.
func ConfigDirectory ¶ added in v0.2.0
func ConfigDirectory(d string)
ConfigDirectory allows users of the package to specify a name for the directory in which config should be located. The default is the binary name as discovered by `path.Base(os.Args[0])`. The config directory will located in a platform specific location (see README.md for more details).
func ConfigFilename ¶ added in v0.2.0
func ConfigFilename(f string)
ConfigFilename allows users of the package to specify the name of the file that contains the configuration. The default is `config`.
func EnvPrefix ¶ added in v0.2.1
func EnvPrefix(p string)
EnvPrefix allows users of the package to specify a prefix for environment variables. Environment variables are uppercase versions of the name specified in the `StringVar` function with `EnvPrefix` prepended. For example a flag of `fileName` and a prefix of `TEST_` will result in an environment variable of `TEST_FILENAME`.
func IntVar ¶ added in v0.3.0
IntVar defines an integer flag with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the flag.
func Parse ¶
func Parse()
Parse parses the command-line flags from os.Args[1:]. Must be called after all flags are defined and before flags are accessed by the program. This will call `flag.Parse` as well a process environment variables and the configuration file. Panics maybe thrown, if: a config file exists but it cannot be opened or it cannot be parsed.
Types ¶
This section is empty.