fix: Check for missing arguments and exit gracefully

This commit is contained in:
Toerd@archlinux 2020-08-16 21:29:21 +02:00
parent f74ff68b76
commit 15736f91d9

View File

@ -34,6 +34,12 @@ Examples:
fmt.Fprintf(flag.CommandLine.Output(), helpMsg, exeName)
}
// Show help and exit if no arguments are provided
if len(os.Args) <= 1 {
flag.Usage()
os.Exit(1)
}
// Name, default val, help
m := flag.String("m", "get", "Method for the request.")