Revert spawn's splitting, blacklist from doc

Blacklist spawn from getting the no_replace_variables doc note.
This commit is contained in:
Jan Verbeek 2016-08-05 18:04:14 +02:00
parent 8a527b5faf
commit 1e97247c63
3 changed files with 17 additions and 6 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' ['cmdline' ...]+
Syntax: +:spawn [*--userscript*] [*--verbose*] [*--detach*] 'cmdline'+
Spawn a command in a shell.
@ -715,6 +715,9 @@ 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.
[[stop]]
=== stop
Stop loading in the current/[count]th tab.

View File

@ -991,8 +991,9 @@ class CommandDispatcher:
finally:
self._tabbed_browser.setUpdatesEnabled(True)
@cmdutils.register(instance='command-dispatcher', scope='window')
def spawn(self, *cmdline, userscript=False, verbose=False, detach=False):
@cmdutils.register(instance='command-dispatcher', scope='window',
maxsplit=0, no_replace_variables=True)
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.
@ -1011,7 +1012,14 @@ class CommandDispatcher:
detach: Whether the command should be detached from qutebrowser.
cmdline: The commandline to execute.
"""
cmd, *args = cmdline
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)
log.procs.debug("Executing {} with args {}, userscript={}".format(
cmd, args, userscript))
if userscript:

View File

@ -240,7 +240,7 @@ def _get_command_doc_notes(cmd):
Strings which should be added to the docs.
"""
if (cmd.maxsplit is not None or cmd.no_cmd_split or
cmd.no_replace_variables):
cmd.no_replace_variables and cmd.name != "spawn"):
yield ""
yield "==== note"
if cmd.maxsplit is not None:
@ -249,7 +249,7 @@ def _get_command_doc_notes(cmd):
if cmd.no_cmd_split:
yield ("* With this command, +;;+ is interpreted literally "
"instead of splitting off a second command.")
if cmd.no_replace_variables:
if cmd.no_replace_variables and cmd.name != "spawn":
yield r"* This command does not replace variables like +\{url\}+."