cmdutils: Default to nargs='+' for *args.

This commit is contained in:
Florian Bruhin 2014-09-14 22:56:02 +02:00
parent d4f584684b
commit b2058e2f0e
2 changed files with 2 additions and 2 deletions

View File

@ -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:

View File

@ -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'] = '?'