fix: Check for missing arguments and exit gracefully

master
Toerd@archlinux 4 years ago
parent f74ff68b76
commit 15736f91d9

@ -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.")

Loading…
Cancel
Save