cmdutils: Default to nargs='+' for *args.
This commit is contained in:
parent
d4f584684b
commit
b2058e2f0e
@ -603,7 +603,7 @@ class CommandDispatcher:
|
|||||||
self.openurl(config.get('general', 'startpage')[0])
|
self.openurl(config.get('general', 'startpage')[0])
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
||||||
def run_userscript(self, cmd, *args):
|
def run_userscript(self, cmd, *args : {'nargs': '*'}):
|
||||||
"""Run an userscript given as argument.
|
"""Run an userscript given as argument.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -308,7 +308,7 @@ class register: # pylint: disable=invalid-name
|
|||||||
kwargs['type'] = typ
|
kwargs['type'] = typ
|
||||||
|
|
||||||
if param.kind == inspect.Parameter.VAR_POSITIONAL:
|
if param.kind == inspect.Parameter.VAR_POSITIONAL:
|
||||||
kwargs['nargs'] = '*'
|
kwargs['nargs'] = '+'
|
||||||
elif typ is not bool and param.default is not inspect.Parameter.empty:
|
elif typ is not bool and param.default is not inspect.Parameter.empty:
|
||||||
kwargs['default'] = param.default
|
kwargs['default'] = param.default
|
||||||
kwargs['nargs'] = '?'
|
kwargs['nargs'] = '?'
|
||||||
|
Loading…
Reference in New Issue
Block a user