cli
cli copied to clipboard
Improve error message when required argument is not set
TL;DR
If a user does not pass a required (positional) argument, we return the generic error message hcloud: accepts 1 arg(s), received 0. This does not help the user in figuring out what the argument should be.
Expected behavior
I would prefer to see something along the lines of
hcloud: No $RESOURCE name was specified, please add the argument. To learn more, add the flag --help.
Right now we use the default cobra argument validators (mostly cobra.ExactArgs(1)) which produce this less-than-useful errors. We will need to write our own version of these validators with improved messages and maybe open an issue upstream to get better versions in cobra.