diff options
author | Philipp Albrecht <palbrecht@mailbox.org> | 2023-07-31 13:53:11 +0200 |
---|---|---|
committer | Philipp Albrecht <palbrecht@mailbox.org> | 2023-08-11 09:00:27 +0200 |
commit | 2fe4864b78486f96e0aa13fc9986388b7fc7a4eb (patch) | |
tree | eafd1a8b086de7a8f477926b90226bd939e8344d | |
parent | 9e21e2e86bee5b0de42fe28153dd1bcb0aa51d27 (diff) | |
download | qutebrowser-2fe4864b78486f96e0aa13fc9986388b7fc7a4eb.tar.gz qutebrowser-2fe4864b78486f96e0aa13fc9986388b7fc7a4eb.zip |
Rename :repeat to :cmd-repeat
Grouping commands related to commands/commandline by prefixing them with `cmd-`.
-rw-r--r-- | doc/help/commands.asciidoc | 38 | ||||
-rw-r--r-- | qutebrowser/misc/utilcmds.py | 5 | ||||
-rw-r--r-- | tests/end2end/features/tabs.feature | 14 | ||||
-rw-r--r-- | tests/end2end/features/utilcmds.feature | 20 |
4 files changed, 39 insertions, 38 deletions
diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index 7f0abc71d..44624e9dd 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -40,6 +40,7 @@ possible to run or bind multiple commands by separating them with `;;`. |<<clear-messages,clear-messages>>|Clear all message notifications. |<<click-element,click-element>>|Click the element matching the given filter. |<<close,close>>|Close the current window. +|<<cmd-repeat,cmd-repeat>>|Repeat a given command. |<<config-clear,config-clear>>|Set all settings back to their default. |<<config-cycle,config-cycle>>|Cycle an option between multiple values. |<<config-dict-add,config-dict-add>>|Add a key/value pair to a dictionary option. @@ -94,7 +95,6 @@ possible to run or bind multiple commands by separating them with `;;`. |<<quickmark-save,quickmark-save>>|Save the current page as a quickmark. |<<quit,quit>>|Quit qutebrowser. |<<reload,reload>>|Reload the current/[count]th tab. -|<<repeat,repeat>>|Repeat a given command. |<<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. @@ -281,6 +281,24 @@ The given filter needs to result in exactly one element, otherwise, an error is === close Close the current window. +[[cmd-repeat]] +=== cmd-repeat +Syntax: +:cmd-repeat 'times' 'command'+ + +Repeat a given command. + +==== positional arguments +* +'times'+: How many times to repeat. +* +'command'+: The command to run, with optional args. + +==== count +Multiplies with 'times' when given. + +==== 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\}+. + [[config-clear]] === config-clear Syntax: +:config-clear [*--save*]+ @@ -1056,24 +1074,6 @@ Reload the current/[count]th tab. ==== count The tab index to reload. -[[repeat]] -=== repeat -Syntax: +:repeat 'times' 'command'+ - -Repeat a given command. - -==== positional arguments -* +'times'+: How many times to repeat. -* +'command'+: The command to run, with optional args. - -==== count -Multiplies with 'times' when given. - -==== 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\}+. - [[repeat-command]] === repeat-command Repeat the last executed command. diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index c54097f36..971dd40b0 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -57,10 +57,11 @@ def later(duration: str, command: str, win_id: int) -> None: raise -@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='repeat') @cmdutils.argument('win_id', value=cmdutils.Value.win_id) @cmdutils.argument('count', value=cmdutils.Value.count) -def repeat(times: int, command: str, win_id: int, count: int = None) -> None: +def cmd_repeat(times: int, command: str, win_id: int, count: int = None) -> None: """Repeat a given command. Args: diff --git a/tests/end2end/features/tabs.feature b/tests/end2end/features/tabs.feature index a5b557122..0454cf4e2 100644 --- a/tests/end2end/features/tabs.feature +++ b/tests/end2end/features/tabs.feature @@ -303,7 +303,7 @@ Feature: Tab management And I run :tab-focus 2 And I run :tab-focus 4 And I run :tab-focus 3 - And I run :repeat 2 tab-focus stack-prev + And I run :cmd-repeat 2 tab-focus stack-prev Then the following tabs should be open: - data/numbers/1.txt - data/numbers/2.txt (active) @@ -322,8 +322,8 @@ Feature: Tab management And I run :tab-focus 2 And I run :tab-focus 4 And I run :tab-focus 3 - And I run :repeat 3 tab-focus stack-prev - And I run :repeat 2 tab-focus stack-next + And I run :cmd-repeat 3 tab-focus stack-prev + And I run :cmd-repeat 2 tab-focus stack-next Then the following tabs should be open: - data/numbers/1.txt - data/numbers/2.txt @@ -338,7 +338,7 @@ Feature: Tab management And I open data/numbers/3.txt in a new tab And I open data/numbers/4.txt in a new tab And I open data/numbers/5.txt in a new tab - And I run :repeat 2 tab-focus stack-prev + And I run :cmd-repeat 2 tab-focus stack-prev And I run :tab-focus stack-next And I set tabs.focus_stack_size to 10 And I run :tab-focus 1 @@ -346,7 +346,7 @@ Feature: Tab management And I run :tab-focus 2 And I run :tab-focus 4 And I run :tab-focus 3 - And I run :repeat 4 tab-focus stack-prev + And I run :cmd-repeat 4 tab-focus stack-prev Then the error "Could not find requested tab!" should be shown And the following tabs should be open: - data/numbers/1.txt (active) @@ -366,8 +366,8 @@ Feature: Tab management And I run :tab-focus 2 And I run :tab-focus 4 And I run :tab-focus 3 - And I run :repeat 2 tab-focus stack-prev - And I run :repeat 3 tab-focus last + And I run :cmd-repeat 2 tab-focus stack-prev + And I run :cmd-repeat 3 tab-focus last Then the following tabs should be open: - data/numbers/1.txt - data/numbers/2.txt diff --git a/tests/end2end/features/utilcmds.feature b/tests/end2end/features/utilcmds.feature index 9fd702d92..75e99ec70 100644 --- a/tests/end2end/features/utilcmds.feature +++ b/tests/end2end/features/utilcmds.feature @@ -27,20 +27,20 @@ Feature: Miscellaneous utility commands exposed to the user. When I run :later 36893488147419103232 scroll down Then the error "Numeric argument is too large for internal int representation." should be shown - ## :repeat + ## :cmd-repeat - Scenario: :repeat simple - When I run :repeat 2 message-info repeat-test + Scenario: :cmd-repeat simple + When I run :cmd-repeat 2 message-info repeat-test Then the message "repeat-test" should be shown And the message "repeat-test" should be shown - Scenario: :repeat zero times - When I run :repeat 0 message-error "repeat-test 2" + Scenario: :cmd-repeat zero times + When I run :cmd-repeat 0 message-error "repeat-test 2" # If we have an error, the test will fail Then no crash should happen - Scenario: :repeat with count - When I run :repeat 3 message-info "repeat-test 3" with count 2 + Scenario: :cmd-repeat with count + When I run :cmd-repeat 3 message-info "repeat-test 3" with count 2 Then the message "repeat-test 3" should be shown And the message "repeat-test 3" should be shown And the message "repeat-test 3" should be shown @@ -78,8 +78,8 @@ Feature: Miscellaneous utility commands exposed to the user. # argparser again @xfail - Scenario: :repeat negative times - When I run :repeat -4 scroll-px 10 0 + Scenario: :cmd-repeat negative times + When I run :cmd-repeat -4 scroll-px 10 0 Then the error "A negative count doesn't make sense." should be shown And the page should not be scrolled @@ -151,7 +151,7 @@ Feature: Miscellaneous utility commands exposed to the user. Scenario: Using :debug-log-capacity When I run :debug-log-capacity 100 And I run :message-info oldstuff - And I run :repeat 20 message-info otherstuff + And I run :cmd-repeat 20 message-info otherstuff And I run :message-info newstuff And I open qute://log Then the page should contain the plaintext "newstuff" |