diff --git a/README.md b/README.md index 2464a82..b733829 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,6 @@ path=/tmp ## TODO - tests -- flag management ## License @@ -73,4 +72,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of this project. -``` \ No newline at end of file +``` diff --git a/cmd/getimap/getimap.go b/cmd/getimap/getimap.go index c2aebfd..f4f0341 100644 --- a/cmd/getimap/getimap.go +++ b/cmd/getimap/getimap.go @@ -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 diff --git a/src/config/config.go b/src/config/config.go index 62aba71..0b09afe 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -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)