Usage (help) invocation cleanup

Bug #1965462 reported by ooboo
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
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.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

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.

Changed in ufw:
assignee: nobody → Jamie Strandboge (jdstrand)
importance: Undecided → Wishlist
status: New → Fix Committed
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

This was fixed in 0.36.2.

Changed in ufw:
status: Fix Committed → Fix Released
Revision history for this message
ooboo (oobooboo) wrote :

Confirming it's working as expected now, thank you for the fix.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.