Make :spawn parse normally without maxsplit

This commit is contained in:
Jan Verbeek 2016-08-05 16:52:47 +02:00
parent 7999c493ac
commit 8a527b5faf
2 changed files with 4 additions and 16 deletions

View File

@ -696,7 +696,7 @@ You can use the `{url}` and `{url:pretty}` variables here which will get replace
[[spawn]]
=== spawn
Syntax: +:spawn [*--userscript*] [*--verbose*] [*--detach*] 'cmdline'+
Syntax: +:spawn [*--userscript*] [*--verbose*] [*--detach*] 'cmdline' ['cmdline' ...]+
Spawn a command in a shell.
@ -715,10 +715,6 @@ Note the `{url}` and `{url:pretty}` variables might be useful here. `{url}` gets
* +*-v*+, +*--verbose*+: Show notifications when the command started/exited.
* +*-d*+, +*--detach*+: Whether the command should be detached from qutebrowser.
==== note
* This command does not split arguments after the last argument and handles quotes literally.
* This command does not replace variables like +\{url\}+.
[[stop]]
=== stop
Stop loading in the current/[count]th tab.

View File

@ -991,9 +991,8 @@ class CommandDispatcher:
finally:
self._tabbed_browser.setUpdatesEnabled(True)
@cmdutils.register(instance='command-dispatcher', scope='window',
maxsplit=0, no_replace_variables=True)
def spawn(self, cmdline, userscript=False, verbose=False, detach=False):
@cmdutils.register(instance='command-dispatcher', scope='window')
def spawn(self, *cmdline, userscript=False, verbose=False, detach=False):
"""Spawn a command in a shell.
Note the `{url}` and `{url:pretty}` variables might be useful here.
@ -1012,14 +1011,7 @@ class CommandDispatcher:
detach: Whether the command should be detached from qutebrowser.
cmdline: The commandline to execute.
"""
try:
cmd, *args = shlex.split(cmdline)
except ValueError as e:
raise cmdexc.CommandError("Error while splitting command: "
"{}".format(e))
args = runners.replace_variables(self._win_id, args)
cmd, *args = cmdline
log.procs.debug("Executing {} with args {}, userscript={}".format(
cmd, args, userscript))
if userscript: