summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2014-12-11 21:25:05 +0100
committerFlorian Bruhin <git@the-compiler.org>2014-12-11 21:27:44 +0100
commit8bad7c0e4ca4f788c7a12dade0d337c5d8b896d6 (patch)
tree0aa6ba0b31f0f539fb10c94fa57fb693a8387a93
parent0acd61368ecc6f4a6f3ec5662dae95c15266d089 (diff)
downloadqutebrowser-8bad7c0e4ca4f788c7a12dade0d337c5d8b896d6.tar.gz
qutebrowser-8bad7c0e4ca4f788c7a12dade0d337c5d8b896d6.zip
Use maxsplit=1 for :repeat and :later.
-rw-r--r--qutebrowser/utils/utilcmds.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/qutebrowser/utils/utilcmds.py b/qutebrowser/utils/utilcmds.py
index bebe7cdc5..51648d0db 100644
--- a/qutebrowser/utils/utilcmds.py
+++ b/qutebrowser/utils/utilcmds.py
@@ -30,17 +30,16 @@ from qutebrowser.config import style
from qutebrowser.widgets import console
-@cmdutils.register(scope='window')
-def later(ms: {'type': int}, *command, win_id: {'special': 'win_id'}):
+@cmdutils.register(scope='window', maxsplit=1)
+def later(ms: {'type': int}, command, win_id: {'special': 'win_id'}):
"""Execute a command after some time.
Args:
ms: How many milliseconds to wait.
- *command: The command to run, with optional args.
+ command: The command to run, with optional args.
"""
if ms < 0:
raise cmdexc.CommandError("I can't run something in the past!")
- cmdline = ' '.join(command)
commandrunner = runners.CommandRunner(win_id)
app = objreg.get('app')
timer = usertypes.Timer(name='later', parent=app)
@@ -52,7 +51,7 @@ def later(ms: {'type': int}, *command, win_id: {'special': 'win_id'}):
raise cmdexc.CommandError("Numeric argument is too large for "
"internal int representation.")
timer.timeout.connect(
- functools.partial(commandrunner.run_safely, cmdline))
+ functools.partial(commandrunner.run_safely, command))
timer.timeout.connect(timer.deleteLater)
timer.start()
except: # pylint: disable=bare-except
@@ -60,20 +59,19 @@ def later(ms: {'type': int}, *command, win_id: {'special': 'win_id'}):
raise
-@cmdutils.register(scope='window')
-def repeat(times: {'type': int}, *command, win_id: {'special': 'win_id'}):
+@cmdutils.register(scope='window', maxsplit=1)
+def repeat(times: {'type': int}, command, win_id: {'special': 'win_id'}):
"""Repeat a given command.
Args:
times: How many times to repeat.
- *command: The command to run, with optional args.
+ command: The command to run, with optional args.
"""
if times < 0:
raise cmdexc.CommandError("A negative count doesn't make sense.")
- cmdline = ' '.join(command)
commandrunner = runners.CommandRunner(win_id)
for _ in range(times):
- commandrunner.run_safely(cmdline)
+ commandrunner.run_safely(command)
@cmdutils.register(debug=True)