Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.
/ cfgFlags Public archive

Go package to use an INI configuration file alongside the "flag" package

License

Notifications You must be signed in to change notification settings

vaz-ar/cfgFlags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cfg_flags

Go package to use an INI configuration file alongside the "flag" package.

Inspired by iniflags, cfg_flags goal is to be simple, without any advanced features like configuration reloading. It is only meant to integrate an INI file with golang's flag package, nothing more.

Usage

Just replace flag.Parse() by cfg_flags.Parse() in your code. cfg_flags.Parse() will return any error that occurs while parsing the configuration file, it is up to you to handle them.

Code sample:

if err := cfg_flags.Parse(); err != nil {
    flag.Usage()
    log.Fatal(err)
}

In order to specify the configuration file to use, you need to set the -config flag, e.g. my_app -config my_config.ini.

About

Go package to use an INI configuration file alongside the "flag" package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages