[PATCH] pager: add 'help' to default attended commands

Idan Kamara idankk86 at gmail.com
Sat Apr 30 12:03:37 CDT 2011


On Sat, Apr 30, 2011 at 7:48 PM, Brodie Rao <brodie at bitheap.org> wrote:

> On Apr 30, 2011, at 4:48 PM, Idan Kamara wrote:
>
>  I initially wanted `hg <cmd> --help` to open the pager too but apparently
>> when dispatch:runcommand sees --help (and --version too it seems),
>> it calls the help command directly rather than going through the possibly
>> wrapped _runcommand, bypassing extensions.
>>
>> I couldn't think of an elegant solution to fix that, other than looking
>> for --help in the args and modifying them in place which feels hackish to
>> me.
>>
>
> I don't think it's worth doing this if we can't get consistent behavior.
>
> If you make dispatch do another dispatch call to the help command when it
> sees --help, that might solve this problem.


That's what I wanted to do but it's a bit tricky: `hg <cmd> --help
--someflag` shows you the help, but if we simply do this transformation:
`hg <cmd> --help --someflag` --> `hg help <cmd> --someflag` then help will
tell us it doesn't recognize --someflag.

So we want to recognize --help (and --version), redirect it to the help
command, but strip non-global options.
Then we get `hg <cmd> --help --someflag --config x.y=z` --> `hg help <cmd>
--config x.y=z`.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20110430/cb09157d/attachment.htm>


More information about the Mercurial-devel mailing list