Usage (help) invocation cleanup
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ufw |
Fix Released
|
Wishlist
|
Jamie Strandboge |
Bug Description
Currently if ufw is run without any arguments, nothing is shown, except the error:
$ ERROR: not enough args
If any argument (that is not known to ufw) is passed, the usage is shown, including the error:
$ ERROR: Invalid syntax
$
$ Usage: ufw COMMAND
$ ...
And of course, if a known argument is passed, usage is not printed along its output.
I see a biggest issue in the fact that ufw doesn't display usage with the first error while it does with the second (probably an early argument parsing issue). I don't want to be a smart ass, but it seems the code could make use of an error+usage print wrapper function/method.
Secondly there is currently no "standard" way (ufw -h) or at least a clean errorless one to display the usage. This is more of a formal issue, but just to point it out. In current implementation, user has to deliberately input garbage to get the program's help, which I believe is not in line with ufw's philosophy.
Tested on version 0.36.1.
Thanks for the bug report. I agree that the arg parsing is suboptimal. I should probably convert over to argparse but definitely something more modern, but that is a larger change. For now, I've committed a change to allow for '-h' and to show the help message when invoked without arguments.