diff options
author | Teddy Wing | 2017-06-03 21:51:43 +0200 |
---|---|---|
committer | Teddy Wing | 2017-06-03 21:51:43 +0200 |
commit | 60b5500b88e9b2b04807d947f943412b99cc09d9 (patch) | |
tree | d67a067372e3848d440b03b2d81a22518ccd7bbf | |
parent | 7729072c262c0e7b76c25dbb09d6f2c6e7dd3eaf (diff) | |
download | timetasker-60b5500b88e9b2b04807d947f943412b99cc09d9.tar.bz2 |
main(): Move `loadConfig()` call after CLI argument parsing
Otherwise, if users haven't created a config file and they run `--help`,
they'll get an error complaining that the config file doesn't exist
instead of helpful usage output.
-rw-r--r-- | main.go | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -19,9 +19,6 @@ var config Config func main() { var err error - err = loadConfig() - kingpin.FatalIfError(err, "could not load config file, try --write-config") - // Parse command line arguments project_alias := kingpin.Flag( "project", @@ -58,6 +55,10 @@ func main() { os.Exit(0) } + + err = loadConfig() + kingpin.FatalIfError(err, "could not load config file, try --write-config") + // Submit time entry project, ok := config.Projects[*project_alias] if !ok { |