From 2521799957b4847c96039d4c62c1299bfa36ab7d Mon Sep 17 00:00:00 2001 From: Utkarsh Verma Date: Sun, 19 Apr 2020 19:59:27 +0530 Subject: [PATCH] CLI flags fix --- cli/cli.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 7b1a13e..738dc64 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -2,7 +2,6 @@ package cli import ( "flag" - "log" "os" ) @@ -24,13 +23,13 @@ func init() { CredsFile = InitCmd.String("creds", "~/.config/qgmail/credentials.json", "Path to Google API client credentials.") TokenFile = InitCmd.String("token", "~/.config/qgmail/token.json", "Path for storing the authorization token.") InitCmd.Parse(os.Args[2:]) - default: - log.Fatal("Invalid argument passed. Run 'qgmail --help` for valid options.") } + + // To future self: add default case. } - flag.Parse() - if InitMode = InitCmd.Parsed(); InitMode { + if InitMode = InitCmd.Parsed(); !InitMode { CredsFile = flag.String("creds", "~/.config/qgmail/credentials.json", "Path to Google API client credentials.") TokenFile = flag.String("token", "~/.config/qgmail/token.json", "Path for storing the authorization token.") } + flag.Parse() }