GNU bug report logs - #6125
[PATCH] Fix indent of --help and --version

Previous Next

Package: coreutils;

Reported by: Zhang Sen <zh.jesse <at> gmail.com>

Date: Thu, 6 May 2010 12:30:09 UTC

Severity: normal

Tags: notabug, patch

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6125 in the body.
You can then email your comments to 6125 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#6125; Package coreutils. (Thu, 06 May 2010 12:30:09 GMT) Full text and rfc822 format available.

Acknowledgement sent to Zhang Sen <zh.jesse <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 06 May 2010 12:30:09 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Zhang Sen <zh.jesse <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: [PATCH] Fix indent of --help and --version
Date: Thu, 06 May 2010 16:00:47 +0800
Hi,

From the several commands I tried, HELP_OPTION_DESCRIPTION and
VERSION_OPTION_DESCRIPTION don't align well with others in the Usage.

$ cat --help
  -u                       (ignored)
  -v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB
      --help     display this help and exit
      --version  output version information and exit

Here is a trivial patch to make the printing of --help/--version be
consistent with other options from Usage.

$ cat --help
  -u                       (ignored)
  -v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB
  --help     display this help and exit
  --version  output version information and exit

Of course the second column is still broken, but I think that's beyond
this simple patch.

Regards,
- jesse

From ba3faa1e0661a6c335a1e7ff525325665a949b79 Mon Sep 17 00:00:00 2001
From: Zhang Sen <zh.jesse <at> gmail.com>
Date: Thu, 6 May 2010 15:07:18 +0800
Subject: [PATCH] Fix indent of --help and --version

Keep consistent with other options, which are printed with two-spaces indent
---
 src/system.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/system.h b/src/system.h
index 859b663..811fde9 100644
--- a/src/system.h
+++ b/src/system.h
@@ -387,9 +387,9 @@ enum
 "for details about the options it supports.\n")
 
 #define HELP_OPTION_DESCRIPTION \
-  _("      --help     display this help and exit\n")
+  _("  --help     display this help and exit\n")
 #define VERSION_OPTION_DESCRIPTION \
-  _("      --version  output version information and exit\n")
+  _("  --version  output version information and exit\n")
 
 #include "closein.h"
 #include "closeout.h"
-- 
1.7.0.6








Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#6125; Package coreutils. (Thu, 06 May 2010 16:51:02 GMT) Full text and rfc822 format available.

Message #8 received at 6125 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Zhang Sen <zh.jesse <at> gmail.com>
Cc: 6125 <at> debbugs.gnu.org
Subject: Re: bug#6125: [PATCH] Fix indent of --help and --version
Date: Thu, 06 May 2010 10:50:22 -0600
[Message part 1 (text/plain, inline)]
On 05/06/2010 02:00 AM, Zhang Sen wrote:
> Hi,
> 
>>From the several commands I tried, HELP_OPTION_DESCRIPTION and
> VERSION_OPTION_DESCRIPTION don't align well with others in the Usage.
> 
> $ cat --help
>   -u                       (ignored)
>   -v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB
>       --help     display this help and exit
>       --version  output version information and exit

First, thanks for taking the time to contribute, and especially for
including a patch.  Too many people make requests with no code to back
it up.  However, I'm hesitant to apply your patch.

I see --help output as having three columns - short options, long
options, and description.  Many options have both short and long (in
your example, -v and --show-nonprinting), some have short only (-u), and
some have long only (--help).  I see nothing wrong with the alignment of
the first two columns in the above example, but agree that the third
column could be better aligned.

I can see your view of --help output having only two columns, and that
the leading - should always be aligned, but I'm not sure I agree with it.

> 
> Here is a trivial patch to make the printing of --help/--version be
> consistent with other options from Usage.
> 
> $ cat --help
>   -u                       (ignored)
>   -v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB
>   --help     display this help and exit
>   --version  output version information and exit

This is a step backwards in my  mind.  It mixes column 1 and 2, rather
than keeping long options in column 2.

> 
> Of course the second column is still broken, but I think that's beyond
> this simple patch.

An even nicer fix would be to write a word-wrapping algorithm, that
takes $COLUMNS into account, and formats all of the columns (short
option, long option, and description) appropriately given the current
screen width and maximum length of the long options column.  But that
means a large rewrite of all of the usage() functions to call this new
formatting system.  It does sound like a nice project, but it's not my
highest priority.

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#6125; Package coreutils. (Fri, 07 May 2010 00:37:01 GMT) Full text and rfc822 format available.

Message #11 received at 6125 <at> debbugs.gnu.org (full text, mbox):

From: Zhang Sen <zh.jesse <at> gmail.com>
To: Eric Blake <eblake <at> redhat.com>
Cc: 6125 <at> debbugs.gnu.org
Subject: Re: bug#6125: [PATCH] Fix indent of --help and --version
Date: Fri, 07 May 2010 08:29:14 +0800
On Thu, 2010-05-06 at 10:50 -0600, Eric Blake wrote:
> I'm hesitant to apply your patch.
> 
> I see --help output as having three columns - short options, long
> options, and description.  Many options have both short and long (in
> your example, -v and --show-nonprinting), some have short only (-u), and
> some have long only (--help).  I see nothing wrong with the alignment of
> the first two columns in the above example

Oops, sorry I missed this. I agree with your view.

> An even nicer fix would be to write a word-wrapping algorithm, that
> takes $COLUMNS into account, and formats all of the columns (short
> option, long option, and description) appropriately given the current
> screen width and maximum length of the long options column.  But that
> means a large rewrite of all of the usage() functions to call this new
> formatting system.

I will try to see, if this doesn't make the code unnecessarily complex.

Thanks, this issue can be closed.

- jesse





bug closed, send any further explanations to Zhang Sen <zh.jesse <at> gmail.com> Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Wed, 14 Jul 2010 16:18:01 GMT) Full text and rfc822 format available.

Added tag(s) notabug. Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Wed, 14 Jul 2010 16:18:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 12 Aug 2010 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 320 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.