provide additional information on error

This commit is contained in:
Eric Engestrom 2019-08-01 17:54:31 +01:00
parent 865a378804
commit 01b6c8815b

14
main.go
View file

@ -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()