added flag management
This commit is contained in:
parent
a9c57e76ba
commit
738fcfc34f
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user