Improve sutcli usage formatting

RESOLVED FIXED

Status

RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: mcote, Assigned: mcote)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

6 years ago
To build on bug 797575, it would be fairly easy to use the textwrap module to nicely wrap the usage text.
(Assignee)

Comment 1

6 years ago
Created attachment 668875 [details] [diff] [review]
Improve sutcli usage formatting

In addition to using textwrap, I did a few other little changes in here, namely
* moving the initial declaration of 'usage' to after we define the commands, to keep it near where we define the command usage
* removed temp variable 'help_args', which is only used in one place
* shortened loop variable names to save space
* removed the " ".join() between commandname and command['help_args'] and just inserted a space into the main string, since both are always simple strings
* used a list comprehension. I don't actually think this is any more readable, nor am I doing it for cool factor, but it is the most concise way to prevent a trailing newline. I think it looks funny to have two blank lines between the usage and error message.

Lemme know if you don't agree with any of those changes.
Attachment #668875 - Flags: review?(wlachance)
Comment on attachment 668875 [details] [diff] [review]
Improve sutcli usage formatting

Review of attachment 668875 [details] [diff] [review]:
-----------------------------------------------------------------

Looks great! Thanks.

Eventually I'd like to switch to a more sophisticated parser for the command line stuff (e.g. http://apenwarr.ca/log/?m=201111), but this is a nice incremental improvement.
Attachment #668875 - Flags: review?(wlachance) → review+
(Assignee)

Comment 3

6 years ago
https://github.com/mozilla/mozbase/commit/c422c2155674ee56f2eae0d17a1545935e20efb6
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.