##// END OF EJS Templates
alias: honor the [defaults] section, fix issue1642
Benoit Boissinot -
r8477:a0104303 default
parent child Browse files
Show More
@@ -11,6 +11,7 b' mycmd = cmd --args'
11 11
12 12 from mercurial.i18n import _
13 13 from mercurial import commands, cmdutil, error
14 import shlex
14 15
15 16 cmdtable = {}
16 17
@@ -69,8 +70,11 b' def uisetup(ui):'
69 70 if not target:
70 71 ui.warn(_('*** [alias] %s: no definition\n') % cmd)
71 72 continue
72 args = target.split(' ')
73 args = shlex.split(target)
73 74 tcmd = args.pop(0)
74 75 if args:
76 defaults = ui.config('defaults', cmd)
77 if defaults:
78 args = shlex.split(defaults) + args
75 79 ui.setconfig('defaults', cmd, ' '.join(args))
76 80 cmdtable[cmd] = lazycommand(ui, cmd, tcmd)
@@ -10,6 +10,13 b' cleanstatus = status -c'
10 10 unknown = bargle
11 11 ambiguous = s
12 12 recursive = recursive
13 mylog = log
14 lognull = log -r null
15
16 [defaults]
17 mylog = -q
18 lognull = -q
19 log = -v
13 20 EOF
14 21
15 22 echo '% basic'
@@ -30,3 +37,7 b' hg ci -Amfoo'
30 37
31 38 echo '% with opts'
32 39 hg cleanst
40
41 echo '% interaction with defaults'
42 hg mylog
43 hg lognull
@@ -8,3 +8,6 b''
8 8 adding foo
9 9 % with opts
10 10 C foo
11 % interaction with defaults
12 0:e63c23eaa88a
13 -1:000000000000
General Comments 0
You need to be logged in to leave comments. Login now