From 01b6c8815ba498b1b3eb39acf52e954031ee8c44 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Thu, 1 Aug 2019 17:54:31 +0100 Subject: [PATCH] provide additional information on error --- main.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 589bdd9..daf9ab3 100644 --- a/main.go +++ b/main.go @@ -22,8 +22,18 @@ var ( func main() { app.HelpFlag.Short('h') kingpin.MustParse(app.Parse(os.Args[1:])) - if (*asDemon && *asSelector) || (!*asDemon && !*asSelector) { - log.Fatal("Missing or incompatible options. See -h/--help for info") + modeCount := 0 + if *asDemon { + modeCount++ + } + if *asSelector { + modeCount++ + } + if modeCount != 1 { + log.Print("Missing or incompatible options. You must provide exactly one of these:") + log.Print(" -d, --demon") + log.Print(" -s, --select") + log.Fatal("See -h/--help for info") } h, err := os.UserHomeDir()