Bug 848095 - Adjust 'subscription-manager --help' layout
Adjust 'subscription-manager --help' layout
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
6.4
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: John Sefler
Entitlement Bugs
:
Depends On:
Blocks: 771481 840993
  Show dependency treegraph
 
Reported: 2012-08-14 11:11 EDT by Matt Reid
Modified: 2013-02-21 03:55 EST (History)
3 users (show)

See Also:
Fixed In Version: subscription-manager-1.1.4-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-21 03:55:36 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
shows how many descriptions take 2 lines (49.45 KB, image/png)
2012-08-14 11:14 EDT, Matt Reid
no flags Details
longer module/option descriptions are unattractive when wrapped (75.10 KB, image/png)
2012-11-19 09:20 EST, John Sefler
no flags Details

  None (edit)
Description Matt Reid 2012-08-14 11:11:59 EDT
Description of problem:
Our output and layout combine to look less than ideal on a default sized terminal (which is 80 characters). This would apply if they're in a tty/sshed, or if they just opened a terminal and haven't resized it.

We have 2 commands that are 1 character too long to fit on a single line in the terminal, 2 more that are 2 characters too long, and 1 that is 3. Along with a few that are significantly too long (1 char - list, unsubscribe; 2 - import, orgs; 3 - redeem, 9+ config, identity, register, unregister, clean).

I think the easiest way to clear up a lot of this is to adjust our default indentation of the modules. We indent them all by 8 characters, which doesn't seem to be a default for --help type stuff. Looking at yum, rpm, and a few other commands, most of those are indented 0 - 2 characters.

Yum seems like the best command to emulate, and it doesn't indent modules/commands at all, options have a 2 character indent. Removing the indent would free up another 8 characters for our descriptions, and fix five descriptions that take two lines by being 1 - 3 characters too long.

I also think we can remove the extra newline right after the line where they typed 'subscription-manager --help' and after 'Usage: ...'. A single line of whitespace should be enough.

You can see the output of subscription-manager --help and yum --help here:
pastebin.redhat.com/101904
(should be active for a month)
Comment 1 Matt Reid 2012-08-14 11:14:32 EDT
Created attachment 604328 [details]
shows how many descriptions take 2 lines
Comment 2 Matt Reid 2012-08-14 11:15:57 EDT
URL should be http://pastebin.test.redhat.com/101904.

Missed the test piece...
Comment 4 Bryan Kearney 2012-10-30 15:14:09 EDT
fixed in master at 881157917884a7eb434b9cc3d00eabdcf61645e6
Comment 6 Adrian Likins 2012-11-08 17:47:26 EST
commit 881157917884a7eb434b9cc3d00eabdcf61645e6
Author: Bryan Kearney <bkearney@redhat.com>
Date:   Tue Oct 30 13:56:58 2012 -0400

    848095: Reduce the indentation on the help text to improve the layout on smaller terminals.
Comment 8 John Sefler 2012-11-19 09:20:42 EST
Created attachment 647778 [details]
longer module/option descriptions are unattractive when wrapped

[root@jsefler-6 ~]# rpm -q subscription-manager
subscription-manager-1.1.9-1.el6.x86_64


I think a better fix for this bug is to use the same wrapping logic used to fix bug 864177
https://bugzilla.redhat.com/show_bug.cgi?id=864177#c4
Comment 9 Matt Reid 2012-11-19 10:40:12 EST
Fix already committed helped clean it up some, but we do still have some strings that are too long regardless.

That's an interesting thought, John, that'd be really nice. BK, would it be super trivial to apply here as well or should I file an RFE for 7.0?
Comment 10 Bryan Kearney 2012-11-19 10:53:15 EST
lets open up a new RFE for 7.0.
Comment 11 Bryan Kearney 2012-11-19 10:54:15 EST
Moving back ON_QA based on previous comments.
Comment 12 Matt Reid 2012-11-19 14:17:56 EST
BZ opened for 7.0 to improve wrapping - https://bugzilla.redhat.com/show_bug.cgi?id=878089
Comment 13 John Sefler 2012-11-19 15:53:21 EST
Demonstrating original complaint...
[root@rhsm-compat-rhel63 ~]# rpm -q subscription-manager
subscription-manager-0.99.19.4-1.el6_3.x86_64

[root@rhsm-compat-rhel63 ~]# subscription-manager --help | egrep "^\s+\w"
	list           List subscription and product information for this machine
	refresh        Pull the latest subscription data from the server
	register       register the client to RHN
	release        Configure what os release to use
	subscribe      Subscribe the registered machine to a specified product
	unregister     unregister the client from RHN
	unsubscribe    Unsubscribe the machine from all or specific subscriptions
	clean          Remove all local consumer and subscription data without affecting the server
	config         List, set, or remove the configuration parameters in use by this machine.
	environments   Display the environments available for a user
	facts          Work with the current facts for this machine
	identity       Display the identity certificate for this machine or request a new one
	import         Import certificates which were provided outside of the tool
	orgs           Display the orgs against which a user can register a system
	redeem         Attempt to redeem a subscription for a preconfigured machine
	repos          List the repos which this machine is entitled to use
	service-level  Manage service levels for this system.
^^^^^^^^
WASTED SPACE HERE IS CONTRIBUTING TO ALL THE UGLY WRAPPED DESCRIPTIONS ON AN 80 CHAR WIDE stty TERMINAL.


SOLUTION FROM COMMENT 6 REPLACES THE LEADING TAB WITH TWO HARD SPACES:
-                    print("\t%-14s %s" % (name, cmd.shortdesc))
+                    print("  %-14s %s" % (name, cmd.shortdesc))
-                print("\t%-14s %s" % (name, cmd.shortdesc))
+                print("  %-14s %s" % (name, cmd.shortdesc))


Verifying Version...
[root@jsefler-6 ~]# rpm -q subscription-manager
subscription-manager-1.1.9-1.el6.x86_64

[root@jsefler-6 ~]# subscription-manager --help | egrep "^\s+\w"
  attach         Attach a specified subscription to the registered system
  list           List subscription and product information for this system
  refresh        Pull the latest subscription data from the server
  register       Register this system to the Customer Portal or another subscription management service
  release        Configure which operating system release to use
  remove         Remove all or specific subscriptions from this system
  unregister     Unregister this system from the Customer Portal or another subscription management service
  clean          Remove all local system and subscription data without affecting the server
  config         List, set, or remove the configuration parameters in use by this system
  environments   Display the environments available for a user
  facts          View or update the detected system information
  identity       Display the identity certificate for this system or request a new one
  import         Import certificates which were provided outside of the tool
  orgs           Display the organizations against which a user can register a system
  redeem         Attempt to redeem a subscription for a preconfigured system
  repos          List the repositories which this system is entitled to use
  service-level  Manage service levels for this system
  subscribe      Deprecated, see attach
  unsubscribe    Deprecated, see remove
  version        Print version information
^^

VERIFIED: We now see two hard spaces instead of a tab, but the original complaint prevails.

Moving this bug to VERIFIED in favor of bug 878089 which will be the ultimate fix.
Comment 15 errata-xmlrpc 2013-02-21 03:55:36 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0350.html

Note You need to log in before you can comment on or make changes to this bug.