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

Martin Geisler mg at daimi.au.dk
Tue Dec 30 09:38:53 CST 2008


FUJIWARA Katsunori <fujiwara at ascade.co.jp> writes:

> I offten see `mercurial/command.py' to confirm type of options: 
> value requirement and multi-value allowance.
>
> So, I wrote patch to display type of each command options in online
> help document.
>
> Current online help displays:
>
>  -f --force      force push
>  -r --rev        a specific revision up to which you would like to push
>  -e --ssh        specify ssh command to use
>
> This patch changes it to:
>
>  -f --force     [F] force push
>  -r --rev       [M] a specific revision up to which you would like to push
>  -e --ssh       [V] specify ssh command to use

Instead of a non-standard format, I would prefer the output from the
standard optparse module. For the push command the options could be
declared like this:

From optparse import OptionParser
parser = OptionParser()
parser.add_option("-f", "--force", help="force push", action="store_true")
parser.add_option("-r", "--rev",
                  help="a specific revision up to which you would like to push")
parser.add_option("-e", "--ssh", help="specify ssh command to use")
parser.add_option("--remotecmd", metavar="CMD",
                  help="specify hg command to run on the remote side")
parser.parse_args()

Running the script with -h on the command line gives:

Options:
  -h, --help         show this help message and exit
  -f, --force        force push
  -r REV, --rev=REV  a specific revision up to which you would like to push
  -e SSH, --ssh=SSH  specify ssh command to use
  --remotecmd=CMD    specify hg command to run on the remote side

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20081230/1c69c6c2/attachment.pgp 


More information about the Mercurial-devel mailing list