--- a/mercurial/registrar.py Mon Apr 03 20:55:55 2017 +0900
+++ b/mercurial/registrar.py Mon Apr 03 21:22:39 2017 +0900
@@ -234,7 +234,7 @@
templatefunc = registrar.templatefunc()
- @templatefunc('myfunc(arg1, arg2[, arg3])')
+ @templatefunc('myfunc(arg1, arg2[, arg3])', argspec='arg1 arg2 arg3')
def myfuncfunc(context, mapping, args):
'''Explanation of this template function ....
'''
@@ -242,6 +242,10 @@
The first string argument is used also in online help.
+ If optional 'argspec' is defined, the function will receive 'args' as
+ a dict of named arguments. Otherwise 'args' is a list of positional
+ arguments.
+
'templatefunc' instance in example above can be used to
decorate multiple functions.
@@ -252,3 +256,6 @@
Otherwise, explicit 'templater.loadfunction()' is needed.
"""
_getname = _funcregistrarbase._parsefuncdecl
+
+ def _extrasetup(self, name, func, argspec=None):
+ func._argspec = argspec