diff options
author | Philipp Albrecht <palbrecht@mailbox.org> | 2023-08-02 13:09:09 +0200 |
---|---|---|
committer | Philipp Albrecht <palbrecht@mailbox.org> | 2023-08-11 09:02:08 +0200 |
commit | f354d3ab91efdbfcf72a3b75b0f221f8539d98eb (patch) | |
tree | be2ef42107d72a507ed1ecf33ab859b614747db8 | |
parent | 20de484de573c92617a13628b83e0f130b34de2e (diff) | |
download | qutebrowser-f354d3ab91efdbfcf72a3b75b0f221f8539d98eb.tar.gz qutebrowser-f354d3ab91efdbfcf72a3b75b0f221f8539d98eb.zip |
Rename :run-with-count to :cmd-run-with-count
Group commands related to commands/commandline by prefixing them with `cmd-`.
-rw-r--r-- | doc/help/commands.asciidoc | 44 | ||||
-rw-r--r-- | qutebrowser/components/scrollcommands.py | 2 | ||||
-rw-r--r-- | qutebrowser/misc/utilcmds.py | 7 | ||||
-rw-r--r-- | tests/end2end/features/utilcmds.feature | 10 | ||||
-rw-r--r-- | tests/end2end/fixtures/quteprocess.py | 2 |
5 files changed, 33 insertions, 32 deletions
diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index 1dda02b98..d0ed53002 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -42,6 +42,7 @@ possible to run or bind multiple commands by separating them with `;;`. |<<close,close>>|Close the current window. |<<cmd-later,cmd-later>>|Execute a command after some time. |<<cmd-repeat,cmd-repeat>>|Repeat a given command. +|<<cmd-run-with-count,cmd-run-with-count>>|Run a command with the given count. |<<cmd-set-text,cmd-set-text>>|Preset the statusbar to some text. |<<config-clear,config-clear>>|Set all settings back to their default. |<<config-cycle,config-cycle>>|Cycle an option between multiple values. @@ -99,7 +100,6 @@ possible to run or bind multiple commands by separating them with `;;`. |<<repeat-command,repeat-command>>|Repeat the last executed command. |<<report,report>>|Report a bug in qutebrowser. |<<restart,restart>>|Restart qutebrowser while keeping existing tabs open. -|<<run-with-count,run-with-count>>|Run a command with the given count. |<<save,save>>|Save configs and state. |<<screenshot,screenshot>>|Take a screenshot of the currently shown part of the page. |<<scroll,scroll>>|Scroll the current tab in the given direction. @@ -314,6 +314,26 @@ Multiplies with 'times' when given. * With this command, +;;+ is interpreted literally instead of splitting off a second command. * This command does not replace variables like +\{url\}+. +[[cmd-run-with-count]] +=== cmd-run-with-count +Syntax: +:cmd-run-with-count 'count-arg' 'command'+ + +Run a command with the given count. + +If cmd_run_with_count itself is run with a count, it multiplies count_arg. + +==== positional arguments +* +'count-arg'+: The count to pass to the command. +* +'command'+: The command to run, with optional args. + +==== count +The count that run_with_count itself received. + +==== note +* This command does not split arguments after the last argument and handles quotes literally. +* With this command, +;;+ is interpreted literally instead of splitting off a second command. +* This command does not replace variables like +\{url\}+. + [[cmd-set-text]] === cmd-set-text Syntax: +:cmd-set-text [*--space*] [*--append*] [*--run-on-count*] 'text'+ @@ -1117,26 +1137,6 @@ Report a bug in qutebrowser. === restart Restart qutebrowser while keeping existing tabs open. -[[run-with-count]] -=== run-with-count -Syntax: +:run-with-count 'count-arg' 'command'+ - -Run a command with the given count. - -If run_with_count itself is run with a count, it multiplies count_arg. - -==== positional arguments -* +'count-arg'+: The count to pass to the command. -* +'command'+: The command to run, with optional args. - -==== count -The count that run_with_count itself received. - -==== note -* This command does not split arguments after the last argument and handles quotes literally. -* With this command, +;;+ is interpreted literally instead of splitting off a second command. -* This command does not replace variables like +\{url\}+. - [[save]] === save Syntax: +:save ['what' ...]+ @@ -1168,7 +1168,7 @@ Syntax: +:scroll 'direction'+ Scroll the current tab in the given direction. -Note you can use `:run-with-count` to have a keybinding with a bigger scroll increment. +Note you can use `:cmd-run-with-count` to have a keybinding with a bigger scroll increment. ==== positional arguments * +'direction'+: In which direction to scroll (up/down/left/right/top/bottom). diff --git a/qutebrowser/components/scrollcommands.py b/qutebrowser/components/scrollcommands.py index 1bf58261b..3ee525535 100644 --- a/qutebrowser/components/scrollcommands.py +++ b/qutebrowser/components/scrollcommands.py @@ -32,7 +32,7 @@ def scroll_px(tab: apitypes.Tab, dx: int, dy: int, count: int = 1) -> None: def scroll(tab: apitypes.Tab, direction: str, count: int = 1) -> None: """Scroll the current tab in the given direction. - Note you can use `:run-with-count` to have a keybinding with a bigger + Note you can use `:cmd-run-with-count` to have a keybinding with a bigger scroll increment. Args: diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index 6ec83bea8..258cc437d 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -80,14 +80,15 @@ def cmd_repeat(times: int, command: str, win_id: int, count: int = None) -> None commandrunner.run_safely(command) -@cmdutils.register(maxsplit=1, no_cmd_split=True, no_replace_variables=True) +@cmdutils.register(maxsplit=1, no_cmd_split=True, no_replace_variables=True, + deprecated_name='run-with-count') @cmdutils.argument('win_id', value=cmdutils.Value.win_id) @cmdutils.argument('count', value=cmdutils.Value.count) -def run_with_count(count_arg: int, command: str, win_id: int, +def cmd_run_with_count(count_arg: int, command: str, win_id: int, count: int = 1) -> None: """Run a command with the given count. - If run_with_count itself is run with a count, it multiplies count_arg. + If cmd_run_with_count itself is run with a count, it multiplies count_arg. Args: count_arg: The count to pass to the command. diff --git a/tests/end2end/features/utilcmds.feature b/tests/end2end/features/utilcmds.feature index da99e62d3..c603c7165 100644 --- a/tests/end2end/features/utilcmds.feature +++ b/tests/end2end/features/utilcmds.feature @@ -48,15 +48,15 @@ Feature: Miscellaneous utility commands exposed to the user. And the message "repeat-test 3" should be shown And the message "repeat-test 3" should be shown - ## :run-with-count + ## :cmd-run-with-count - Scenario: :run-with-count - When I run :run-with-count 2 message-info "run-with-count test" + Scenario: :cmd-run-with-count + When I run :cmd-run-with-count 2 message-info "run-with-count test" Then the message "run-with-count test" should be shown And the message "run-with-count test" should be shown - Scenario: :run-with-count with count - When I run :run-with-count 2 message-info "run-with-count test 2" with count 2 + Scenario: :cmd-run-with-count with count + When I run :cmd-run-with-count 2 message-info "run-with-count test 2" with count 2 Then the message "run-with-count test 2" should be shown And the message "run-with-count test 2" should be shown And the message "run-with-count test 2" should be shown diff --git a/tests/end2end/fixtures/quteprocess.py b/tests/end2end/fixtures/quteprocess.py index 37989ecb5..a10fd5414 100644 --- a/tests/end2end/fixtures/quteprocess.py +++ b/tests/end2end/fixtures/quteprocess.py @@ -596,7 +596,7 @@ class QuteProc(testprocess.Process): command = command.replace('\\', r'\\') if count is not None: - command = ':run-with-count {} {}'.format(count, + command = ':cmd-run-with-count {} {}'.format(count, command.lstrip(':')) self.send_ipc([command]) |