Pergunta

by default, just typing hg in the command prompt will show the basic help - what is nice for novice, of course.

But is there a way to modify this, so that for example the current summary is shown? (i.e. get the result of hg sum when just typing hg).


BTW: What I do in place of that, is having one character alias configured like this

[alias]
, = glog -l5 --template "{rev}:{node|short} [{tags}] {desc|firstline}\n"
. = !%HG% sum && echo. && echo *** GUARDS *** && %HG% qsel && echo. && echo *** applied PATCHES *** && %HG% qap

I just want to know if this can further be optimized.

Foi útil?

Solução

No, there is no such feature in Mercurial. You can do it with a small extension, though:

import sys
from mercurial import dispatch, extensions, commands

def uisetup(ui):
    extensions.wrapfunction(commands, 'help_', default)

def default(orig, ui, repo, **opts):
    if len(sys.argv) == 1:
        # No command given
        sys.argv.append('summary')
        return dispatch.run()
    else:
        return orig(ui, repo, **opts)

Put the above in a file called, say, default.py and load the extension. A plain hg will now behave like hg summary and things like hg add -h still trigger the help.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top