[PATCH 0 of 1] Display type of each command options in online help document.

FUJIWARA Katsunori fujiwara at ascade.co.jp
Sat Feb 14 03:16:17 CST 2009


At Fri, 13 Feb 2009 23:52:45 +0100,
Martin Geisler wrote:

> > I checked optparse library, and thought as below to keep string under
> > 80 chars:
> 
> The optparse library will actually wrap the lines as needed.

Thanks you for teaching me about auto wrapping of optparse

# I have not known it :-)

But, sorry for ambiguous writing, I wanted to focus on by "keep string
under 80 chars":

  the shorter option sample part, the bigger human readability becomes

For example, formatting like current hg help function formats:

  -a             --a-flag-option            description of flag option
  -x LONG-OPTION --long-option LONG-OPTION  description of long option
  -v VALUE       --value VALUE              description of value option

This does not seems to be good for reader, because width of
description part is too short in screen.

Optparse lib ensures wider area, but:

  -a, --a-flag-option     description of flag option
  -v VALUE, --value VALUE description of value option
  -x LONG-OPTION, --long-option LONG-OPTION
                          description of long option

I think that "table like alignment" is very important for reader.

So, both for "wider area for description" and "table like alignment",
I chose:

    - omit "metavar"(term of optparse lib) for short form

    - use fixed("VAL") metavar for long form

      * auto-abbreviation in short size is very difficult(some option
        has very long name in long form), but forcing implementor to
        specify metavar in option table tuple does not seem to be
        good.

This policy will format like as:

  -a  --a-flag-option    description of flag option
  -x  --long-option VAL  description of long option
  -v  --value VAL        description of value option

--------------------
[FUJIWARA Katsunori]      fujiwara at ascade.co.jp(foozy at lares.dti.ne.jp)



More information about the Mercurial-devel mailing list