added flag management

This commit is contained in:
Paul 2020-03-10 14:26:00 +01:00
parent a9c57e76ba
commit 738fcfc34f
3 changed files with 2 additions and 10 deletions

View File

@ -42,7 +42,6 @@ path=/tmp
## TODO
- tests
- flag management
## License

View File

@ -21,14 +21,6 @@ func main() {
gi = new(getimaplib.GetImap)
if len(os.Args) > 1 {
configfile = os.Args[1]
} else {
utils.Usage()
os.Exit(1)
}
utils.HandleFatalError(err)
mainconfig := config.GetConfig(configfile)
gi.Config = mainconfig

View File

@ -11,6 +11,7 @@ import (
// GetConfig fetch the configuration from ini file
func GetConfig(configfile string) *Config {
flag.Usage = utils.Usage
flag.StringVar(&configfile, "configfile", "getimap.ini", "config file to use with getimap section")
flag.Parse()
cfg, err := ini.Load(configfile)