aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorTeddy Wing2017-06-03 21:51:43 +0200
committerTeddy Wing2017-06-03 21:51:43 +0200
commit60b5500b88e9b2b04807d947f943412b99cc09d9 (patch)
treed67a067372e3848d440b03b2d81a22518ccd7bbf /main.go
parent7729072c262c0e7b76c25dbb09d6f2c6e7dd3eaf (diff)
downloadtimetasker-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.
Diffstat (limited to 'main.go')
-rw-r--r--main.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/main.go b/main.go
index e0e4af1..f067867 100644
--- a/main.go
+++ b/main.go
@@ -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 {