Remove hiding of commands

This was often confusing for people - let's instead just hide commands which are
not available in normal mode.
This commit is contained in:
Florian Bruhin 2017-11-13 07:59:54 +01:00
parent 009fa845f4
commit f6cc6677dd
16 changed files with 326 additions and 347 deletions

View File

@ -470,7 +470,6 @@ The following arguments are supported for `@cmdutils.argument`:
- `flag`: Customize the short flag (`-x`) the argument will get.
- `win_id=True`: Mark the argument as special window ID argument.
- `count=True`: Mark the argument as special count argument.
- `hide=True`: Hide the argument from the documentation.
- `completion`: A completion function (see `qutebrowser.completions.models.*`)
to use when completing arguments for the given command.
- `choices`: The allowed string choices for the argument.

View File

@ -30,6 +30,9 @@ It is possible to run or bind multiple commands by separating them with `;;`.
|<<bookmark-del,bookmark-del>>|Delete a bookmark.
|<<bookmark-load,bookmark-load>>|Load a bookmark.
|<<buffer,buffer>>|Select tab by index or url/title best match.
|<<clear-keychain,clear-keychain>>|Clear the currently entered key chain.
|<<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.
|<<config-clear,config-clear>>|Set all settings back to their default.
|<<config-cycle,config-cycle>>|Cycle an option between multiple values.
@ -45,7 +48,9 @@ It is possible to run or bind multiple commands by separating them with `;;`.
|<<download-remove,download-remove>>|Remove the last/[count]th download from the list.
|<<download-retry,download-retry>>|Retry the first failed/[count]th download.
|<<edit-url,edit-url>>|Navigate to a url formed in an external editor.
|<<enter-mode,enter-mode>>|Enter a key mode.
|<<fake-key,fake-key>>|Send a fake keypress or key string to the website or qutebrowser.
|<<follow-selected,follow-selected>>|Follow the selected text.
|<<forward,forward>>|Go forward in the history of the current tab.
|<<fullscreen,fullscreen>>|Toggle fullscreen mode.
|<<help,help>>|Show help about a command or setting.
@ -56,9 +61,14 @@ It is possible to run or bind multiple commands by separating them with `;;`.
|<<insert-text,insert-text>>|Insert text at cursor position.
|<<inspector,inspector>>|Toggle the web inspector.
|<<jseval,jseval>>|Evaluate a JavaScript string.
|<<jump-mark,jump-mark>>|Jump to the mark named by `key`.
|<<later,later>>|Execute a command after some time.
|<<message-error,message-error>>|Show an error message in the statusbar.
|<<message-info,message-info>>|Show an info message in the statusbar.
|<<message-warning,message-warning>>|Show a warning message in the statusbar.
|<<messages,messages>>|Show a log of past messages.
|<<navigate,navigate>>|Open typical prev/next links or navigate using the URL path.
|<<nop,nop>>|Do nothing.
|<<open,open>>|Open a URL in the current/[count]th tab.
|<<open-editor,open-editor>>|Open an external editor with the currently selected form field.
|<<print,print>>|Print the current/[count]th tab.
@ -70,16 +80,25 @@ It is possible to run or bind multiple commands by separating them with `;;`.
|<<record-macro,record-macro>>|Start or stop recording a macro.
|<<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.
|<<run-macro,run-macro>>|Run a recorded macro.
|<<run-with-count,run-with-count>>|Run a command with the given count.
|<<save,save>>|Save configs and state.
|<<scroll,scroll>>|Scroll the current tab in the given direction.
|<<scroll-page,scroll-page>>|Scroll the frame page-wise.
|<<scroll-px,scroll-px>>|Scroll the current tab by 'count * dx/dy' pixels.
|<<scroll-to-perc,scroll-to-perc>>|Scroll to a specific percentage of the page.
|<<search,search>>|Search for a text on the current page. With no text, clear results.
|<<search-next,search-next>>|Continue the search to the ([count]th) next term.
|<<search-prev,search-prev>>|Continue the search to the ([count]th) previous term.
|<<session-delete,session-delete>>|Delete a session.
|<<session-load,session-load>>|Load a session.
|<<session-save,session-save>>|Save a session.
|<<set,set>>|Set an option.
|<<set-cmd-text,set-cmd-text>>|Preset the statusbar to some text.
|<<set-mark,set-mark>>|Set a mark at the current scroll position in the current tab.
|<<spawn,spawn>>|Spawn a command in a shell.
|<<stop,stop>>|Stop loading in the current/[count]th tab.
|<<tab-clone,tab-clone>>|Duplicate the current tab.
@ -209,6 +228,31 @@ The tab index to focus, starting with 1.
==== note
* This command does not split arguments after the last argument and handles quotes literally.
[[clear-keychain]]
=== clear-keychain
Clear the currently entered key chain.
[[clear-messages]]
=== clear-messages
Clear all message notifications.
[[click-element]]
=== click-element
Syntax: +:click-element [*--target* 'target'] [*--force-event*] 'filter' 'value'+
Click the element matching the given filter.
The given filter needs to result in exactly one element, otherwise, an error is shown.
==== positional arguments
* +'filter'+: How to filter the elements. id: Get an element based on its ID.
* +'value'+: The value to filter for.
==== optional arguments
* +*-t*+, +*--target*+: How to open the clicked element (normal/tab/tab-bg/window).
* +*-f*+, +*--force-event*+: Force generating a fake click event.
[[close]]
=== close
Close the current window.
@ -382,6 +426,15 @@ The editor which should be launched can be configured via the `editor.command` c
* +*-r*+, +*--related*+: If opening a new tab, position the tab as related to the current one (like clicking on a link).
[[enter-mode]]
=== enter-mode
Syntax: +:enter-mode 'mode'+
Enter a key mode.
==== positional arguments
* +'mode'+: The mode to enter.
[[fake-key]]
=== fake-key
Syntax: +:fake-key [*--global*] 'keystring'+
@ -396,6 +449,15 @@ Send a fake keypress or key string to the website or qutebrowser.
==== optional arguments
* +*-g*+, +*--global*+: If given, the keys are sent to the qutebrowser UI.
[[follow-selected]]
=== follow-selected
Syntax: +:follow-selected [*--tab*]+
Follow the selected text.
==== optional arguments
* +*-t*+, +*--tab*+: Load the selected link in a new tab.
[[forward]]
=== forward
Syntax: +:forward [*--tab*] [*--bg*] [*--window*]+
@ -576,6 +638,15 @@ Evaluate a JavaScript string.
* 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.
[[jump-mark]]
=== jump-mark
Syntax: +:jump-mark 'key'+
Jump to the mark named by `key`.
==== positional arguments
* +'key'+: mark identifier; capital indicates a global mark
[[later]]
=== later
Syntax: +:later 'ms' 'command'+
@ -591,6 +662,36 @@ Execute a command after some time.
* With this command, +;;+ is interpreted literally instead of splitting off a second command.
* This command does not replace variables like +\{url\}+.
[[message-error]]
=== message-error
Syntax: +:message-error 'text'+
Show an error message in the statusbar.
==== positional arguments
* +'text'+: The text to show.
[[message-info]]
=== message-info
Syntax: +:message-info 'text'+
Show an info message in the statusbar.
==== positional arguments
* +'text'+: The text to show.
==== count
How many times to show the message
[[message-warning]]
=== message-warning
Syntax: +:message-warning 'text'+
Show a warning message in the statusbar.
==== positional arguments
* +'text'+: The text to show.
[[messages]]
=== messages
Syntax: +:messages [*--plain*] [*--tab*] [*--bg*] [*--window*] ['level']+
@ -636,6 +737,10 @@ This tries to automatically click on typical _Previous Page_ or _Next Page_ link
For `increment` and `decrement`, the number to change the URL by. For `up`, the number of levels to go up in the URL.
[[nop]]
=== nop
Do nothing.
[[open]]
=== open
Syntax: +:open [*--related*] [*--bg*] [*--tab*] [*--window*] [*--secure*] [*--private*]
@ -778,6 +883,13 @@ Repeat a given command.
* 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.
==== count
Which count to pass the command.
[[report]]
=== report
Report a bug in qutebrowser.
@ -798,6 +910,26 @@ Run a recorded macro.
==== count
How many times to run the macro.
[[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' ['what' ...]]+
@ -808,6 +940,70 @@ Save configs and state.
* +'what'+: What to save (`config`/`key-config`/`cookies`/...). If not given, everything is saved.
[[scroll]]
=== scroll
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.
==== positional arguments
* +'direction'+: In which direction to scroll (up/down/left/right/top/bottom).
==== count
multiplier
[[scroll-page]]
=== scroll-page
Syntax: +:scroll-page [*--top-navigate* 'ACTION'] [*--bottom-navigate* 'ACTION'] 'x' 'y'+
Scroll the frame page-wise.
==== positional arguments
* +'x'+: How many pages to scroll to the right.
* +'y'+: How many pages to scroll down.
==== optional arguments
* +*-t*+, +*--top-navigate*+: :navigate action (prev, decrement) to run when scrolling up at the top of the page.
* +*-b*+, +*--bottom-navigate*+: :navigate action (next, increment) to run when scrolling down at the bottom of the page.
==== count
multiplier
[[scroll-px]]
=== scroll-px
Syntax: +:scroll-px 'dx' 'dy'+
Scroll the current tab by 'count * dx/dy' pixels.
==== positional arguments
* +'dx'+: How much to scroll in x-direction.
* +'dy'+: How much to scroll in y-direction.
==== count
multiplier
[[scroll-to-perc]]
=== scroll-to-perc
Syntax: +:scroll-to-perc [*--horizontal*] ['perc']+
Scroll to a specific percentage of the page.
The percentage can be given either as argument or as count. If no percentage is given, the page is scrolled to the end.
==== positional arguments
* +'perc'+: Percentage to scroll.
==== optional arguments
* +*-x*+, +*--horizontal*+: Scroll horizontally instead of vertically.
==== count
Percentage to scroll.
[[search]]
=== search
Syntax: +:search [*--reverse*] ['text']+
@ -823,6 +1019,20 @@ Search for a text on the current page. With no text, clear results.
==== note
* This command does not split arguments after the last argument and handles quotes literally.
[[search-next]]
=== search-next
Continue the search to the ([count]th) next term.
==== count
How many elements to ignore.
[[search-prev]]
=== search-prev
Continue the search to the ([count]th) previous term.
==== count
How many elements to ignore.
[[session-delete]]
=== session-delete
Syntax: +:session-delete [*--force*] 'name'+
@ -907,6 +1117,15 @@ The count if given.
==== note
* This command does not split arguments after the last argument and handles quotes literally.
[[set-mark]]
=== set-mark
Syntax: +:set-mark 'key'+
Set a mark at the current scroll position in the current tab.
==== positional arguments
* +'key'+: mark identifier; capital indicates a global mark
[[spawn]]
=== spawn
Syntax: +:spawn [*--userscript*] [*--verbose*] [*--detach*] 'cmdline'+
@ -1132,14 +1351,11 @@ Decrease the zoom level for the current tab.
How many steps to zoom out.
== Hidden commands
== Commands not usable in normal mode
.Quick reference
[options="header",width="75%",cols="25%,75%"]
|==============
|Command|Description
|<<clear-keychain,clear-keychain>>|Clear the currently entered key chain.
|<<clear-messages,clear-messages>>|Clear all message notifications.
|<<click-element,click-element>>|Click the element matching the given filter.
|<<command-accept,command-accept>>|Execute the command currently in the commandline.
|<<command-history-next,command-history-next>>|Go forward in the commandline history.
|<<command-history-prev,command-history-prev>>|Go back in the commandline history.
@ -1147,14 +1363,8 @@ How many steps to zoom out.
|<<completion-item-focus,completion-item-focus>>|Shift the focus of the completion menu to another item.
|<<completion-item-yank,completion-item-yank>>|Yank the current completion item into the clipboard.
|<<drop-selection,drop-selection>>|Drop selection and keep selection mode enabled.
|<<enter-mode,enter-mode>>|Enter a key mode.
|<<follow-hint,follow-hint>>|Follow a hint.
|<<follow-selected,follow-selected>>|Follow the selected text.
|<<jump-mark,jump-mark>>|Jump to the mark named by `key`.
|<<leave-mode,leave-mode>>|Leave the mode we're currently in.
|<<message-error,message-error>>|Show an error message in the statusbar.
|<<message-info,message-info>>|Show an info message in the statusbar.
|<<message-warning,message-warning>>|Show a warning message in the statusbar.
|<<move-to-end-of-document,move-to-end-of-document>>|Move the cursor or selection to the end of the document.
|<<move-to-end-of-line,move-to-end-of-line>>|Move the cursor or selection to the end of line.
|<<move-to-end-of-next-block,move-to-end-of-next-block>>|Move the cursor or selection to the end of next block.
@ -1170,11 +1380,9 @@ How many steps to zoom out.
|<<move-to-start-of-line,move-to-start-of-line>>|Move the cursor or selection to the start of the line.
|<<move-to-start-of-next-block,move-to-start-of-next-block>>|Move the cursor or selection to the start of next block.
|<<move-to-start-of-prev-block,move-to-start-of-prev-block>>|Move the cursor or selection to the start of previous block.
|<<nop,nop>>|Do nothing.
|<<prompt-accept,prompt-accept>>|Accept the current prompt.
|<<prompt-item-focus,prompt-item-focus>>|Shift the focus of the prompt file completion menu to another item.
|<<prompt-open-download,prompt-open-download>>|Immediately open a download.
|<<repeat-command,repeat-command>>|Repeat the last executed command.
|<<rl-backward-char,rl-backward-char>>|Move back a character.
|<<rl-backward-delete-char,rl-backward-delete-char>>|Delete the character before the cursor.
|<<rl-backward-kill-word,rl-backward-kill-word>>|Remove chars from the cursor to the beginning of the word.
@ -1190,41 +1398,8 @@ How many steps to zoom out.
|<<rl-unix-line-discard,rl-unix-line-discard>>|Remove chars backward from the cursor to the beginning of the line.
|<<rl-unix-word-rubout,rl-unix-word-rubout>>|Remove chars from the cursor to the beginning of the word.
|<<rl-yank,rl-yank>>|Paste the most recently deleted text.
|<<run-with-count,run-with-count>>|Run a command with the given count.
|<<scroll,scroll>>|Scroll the current tab in the given direction.
|<<scroll-page,scroll-page>>|Scroll the frame page-wise.
|<<scroll-px,scroll-px>>|Scroll the current tab by 'count * dx/dy' pixels.
|<<scroll-to-perc,scroll-to-perc>>|Scroll to a specific percentage of the page.
|<<search-next,search-next>>|Continue the search to the ([count]th) next term.
|<<search-prev,search-prev>>|Continue the search to the ([count]th) previous term.
|<<set-mark,set-mark>>|Set a mark at the current scroll position in the current tab.
|<<toggle-selection,toggle-selection>>|Toggle caret selection mode.
|==============
[[clear-keychain]]
=== clear-keychain
Clear the currently entered key chain.
[[clear-messages]]
=== clear-messages
Clear all message notifications.
[[click-element]]
=== click-element
Syntax: +:click-element [*--target* 'target'] [*--force-event*] 'filter' 'value'+
Click the element matching the given filter.
The given filter needs to result in exactly one element, otherwise, an error is shown.
==== positional arguments
* +'filter'+: How to filter the elements. id: Get an element based on its ID.
* +'value'+: The value to filter for.
==== optional arguments
* +*-t*+, +*--target*+: How to open the clicked element (normal/tab/tab-bg/window).
* +*-f*+, +*--force-event*+: Force generating a fake click event.
[[command-accept]]
=== command-accept
Execute the command currently in the commandline.
@ -1263,15 +1438,6 @@ Yank the current completion item into the clipboard.
=== drop-selection
Drop selection and keep selection mode enabled.
[[enter-mode]]
=== enter-mode
Syntax: +:enter-mode 'mode'+
Enter a key mode.
==== positional arguments
* +'mode'+: The mode to enter.
[[follow-hint]]
=== follow-hint
Syntax: +:follow-hint ['keystring']+
@ -1281,58 +1447,10 @@ Follow a hint.
==== positional arguments
* +'keystring'+: The hint to follow.
[[follow-selected]]
=== follow-selected
Syntax: +:follow-selected [*--tab*]+
Follow the selected text.
==== optional arguments
* +*-t*+, +*--tab*+: Load the selected link in a new tab.
[[jump-mark]]
=== jump-mark
Syntax: +:jump-mark 'key'+
Jump to the mark named by `key`.
==== positional arguments
* +'key'+: mark identifier; capital indicates a global mark
[[leave-mode]]
=== leave-mode
Leave the mode we're currently in.
[[message-error]]
=== message-error
Syntax: +:message-error 'text'+
Show an error message in the statusbar.
==== positional arguments
* +'text'+: The text to show.
[[message-info]]
=== message-info
Syntax: +:message-info 'text'+
Show an info message in the statusbar.
==== positional arguments
* +'text'+: The text to show.
==== count
How many times to show the message
[[message-warning]]
=== message-warning
Syntax: +:message-warning 'text'+
Show a warning message in the statusbar.
==== positional arguments
* +'text'+: The text to show.
[[move-to-end-of-document]]
=== move-to-end-of-document
Move the cursor or selection to the end of the document.
@ -1426,10 +1544,6 @@ Move the cursor or selection to the start of previous block.
==== count
How many blocks to move.
[[nop]]
=== nop
Do nothing.
[[prompt-accept]]
=== prompt-accept
Syntax: +:prompt-accept ['value']+
@ -1466,13 +1580,6 @@ If no specific command is given, this will use the system's default application
==== note
* This command does not split arguments after the last argument and handles quotes literally.
[[repeat-command]]
=== repeat-command
Repeat the last executed command.
==== count
Which count to pass the command.
[[rl-backward-char]]
=== rl-backward-char
Move back a character.
@ -1563,113 +1670,6 @@ Paste the most recently deleted text.
This acts like readline's yank.
[[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\}+.
[[scroll]]
=== scroll
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.
==== positional arguments
* +'direction'+: In which direction to scroll (up/down/left/right/top/bottom).
==== count
multiplier
[[scroll-page]]
=== scroll-page
Syntax: +:scroll-page [*--top-navigate* 'ACTION'] [*--bottom-navigate* 'ACTION'] 'x' 'y'+
Scroll the frame page-wise.
==== positional arguments
* +'x'+: How many pages to scroll to the right.
* +'y'+: How many pages to scroll down.
==== optional arguments
* +*-t*+, +*--top-navigate*+: :navigate action (prev, decrement) to run when scrolling up at the top of the page.
* +*-b*+, +*--bottom-navigate*+: :navigate action (next, increment) to run when scrolling down at the bottom of the page.
==== count
multiplier
[[scroll-px]]
=== scroll-px
Syntax: +:scroll-px 'dx' 'dy'+
Scroll the current tab by 'count * dx/dy' pixels.
==== positional arguments
* +'dx'+: How much to scroll in x-direction.
* +'dy'+: How much to scroll in y-direction.
==== count
multiplier
[[scroll-to-perc]]
=== scroll-to-perc
Syntax: +:scroll-to-perc [*--horizontal*] ['perc']+
Scroll to a specific percentage of the page.
The percentage can be given either as argument or as count. If no percentage is given, the page is scrolled to the end.
==== positional arguments
* +'perc'+: Percentage to scroll.
==== optional arguments
* +*-x*+, +*--horizontal*+: Scroll horizontally instead of vertically.
==== count
Percentage to scroll.
[[search-next]]
=== search-next
Continue the search to the ([count]th) next term.
==== count
How many elements to ignore.
[[search-prev]]
=== search-prev
Continue the search to the ([count]th) previous term.
==== count
How many elements to ignore.
[[set-mark]]
=== set-mark
Syntax: +:set-mark 'key'+
Set a mark at the current scroll position in the current tab.
==== positional arguments
* +'key'+: mark identifier; capital indicates a global mark
[[toggle-selection]]
=== toggle-selection
Toggle caret selection mode.

View File

@ -565,8 +565,8 @@ class CommandDispatcher:
tabbed_browser.tabopen(self._current_url())
self._tabbed_browser.close_tab(self._current_widget(), add_undo=False)
@cmdutils.register(instance='command-dispatcher', hide=True,
scope='window', deprecated='Use :tab-give instead!')
@cmdutils.register(instance='command-dispatcher', scope='window',
deprecated='Use :tab-give instead!')
def tab_detach(self):
"""Deprecated way to detach a tab."""
self.tab_give()
@ -677,8 +677,7 @@ class CommandDispatcher:
except navigate.Error as e:
raise cmdexc.CommandError(e)
@cmdutils.register(instance='command-dispatcher', hide=True,
scope='window')
@cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('count', count=True)
def scroll_px(self, dx: int, dy: int, count=1):
"""Scroll the current tab by 'count * dx/dy' pixels.
@ -694,8 +693,7 @@ class CommandDispatcher:
cmdutils.check_overflow(dy, 'int')
self._current_widget().scroller.delta(dx, dy)
@cmdutils.register(instance='command-dispatcher', hide=True,
scope='window')
@cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('count', count=True)
def scroll(self, direction: typing.Union[str, int], count=1):
"""Scroll the current tab in the given direction.
@ -732,8 +730,7 @@ class CommandDispatcher:
else:
func(count=count)
@cmdutils.register(instance='command-dispatcher', hide=True,
scope='window')
@cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('count', count=True)
@cmdutils.argument('horizontal', flag='x')
def scroll_to_perc(self, perc: float = None, horizontal=False, count=None):
@ -764,8 +761,7 @@ class CommandDispatcher:
self._current_widget().scroller.to_perc(x, y)
@cmdutils.register(instance='command-dispatcher', hide=True,
scope='window')
@cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('count', count=True)
@cmdutils.argument('top_navigate', metavar='ACTION',
choices=('prev', 'decrement'))
@ -1388,8 +1384,7 @@ class CommandDispatcher:
except KeyError:
raise cmdexc.CommandError("Bookmark '{}' not found!".format(url))
@cmdutils.register(instance='command-dispatcher', hide=True,
scope='window')
@cmdutils.register(instance='command-dispatcher', scope='window')
def follow_selected(self, *, tab=False):
"""Follow the selected text.
@ -1674,8 +1669,7 @@ class CommandDispatcher:
tab.elements.find_focused(_insert_text_cb)
@cmdutils.register(instance='command-dispatcher', scope='window',
hide=True)
@cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('filter_', choices=['id'])
def click_element(self, filter_: str, value, *,
target: usertypes.ClickTarget =
@ -1780,8 +1774,7 @@ class CommandDispatcher:
tab.search.search(text, **options)
@cmdutils.register(instance='command-dispatcher', hide=True,
scope='window')
@cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('count', count=True)
def search_next(self, count=1):
"""Continue the search to the ([count]th) next term.
@ -1815,8 +1808,7 @@ class CommandDispatcher:
tab.search.next_result()
tab.search.next_result(result_cb=cb)
@cmdutils.register(instance='command-dispatcher', hide=True,
scope='window')
@cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('count', count=True)
def search_prev(self, count=1):
"""Continue the search to the ([count]th) previous term.
@ -1850,8 +1842,8 @@ class CommandDispatcher:
tab.search.prev_result()
tab.search.prev_result(result_cb=cb)
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
@cmdutils.argument('count', count=True)
def move_to_next_line(self, count=1):
"""Move the cursor or selection to the next line.
@ -1861,8 +1853,8 @@ class CommandDispatcher:
"""
self._current_widget().caret.move_to_next_line(count)
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
@cmdutils.argument('count', count=True)
def move_to_prev_line(self, count=1):
"""Move the cursor or selection to the prev line.
@ -1872,8 +1864,8 @@ class CommandDispatcher:
"""
self._current_widget().caret.move_to_prev_line(count)
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
@cmdutils.argument('count', count=True)
def move_to_next_char(self, count=1):
"""Move the cursor or selection to the next char.
@ -1883,8 +1875,8 @@ class CommandDispatcher:
"""
self._current_widget().caret.move_to_next_char(count)
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
@cmdutils.argument('count', count=True)
def move_to_prev_char(self, count=1):
"""Move the cursor or selection to the previous char.
@ -1894,8 +1886,8 @@ class CommandDispatcher:
"""
self._current_widget().caret.move_to_prev_char(count)
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
@cmdutils.argument('count', count=True)
def move_to_end_of_word(self, count=1):
"""Move the cursor or selection to the end of the word.
@ -1905,8 +1897,8 @@ class CommandDispatcher:
"""
self._current_widget().caret.move_to_end_of_word(count)
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
@cmdutils.argument('count', count=True)
def move_to_next_word(self, count=1):
"""Move the cursor or selection to the next word.
@ -1916,8 +1908,8 @@ class CommandDispatcher:
"""
self._current_widget().caret.move_to_next_word(count)
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
@cmdutils.argument('count', count=True)
def move_to_prev_word(self, count=1):
"""Move the cursor or selection to the previous word.
@ -1927,20 +1919,20 @@ class CommandDispatcher:
"""
self._current_widget().caret.move_to_prev_word(count)
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
def move_to_start_of_line(self):
"""Move the cursor or selection to the start of the line."""
self._current_widget().caret.move_to_start_of_line()
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
def move_to_end_of_line(self):
"""Move the cursor or selection to the end of line."""
self._current_widget().caret.move_to_end_of_line()
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
@cmdutils.argument('count', count=True)
def move_to_start_of_next_block(self, count=1):
"""Move the cursor or selection to the start of next block.
@ -1950,8 +1942,8 @@ class CommandDispatcher:
"""
self._current_widget().caret.move_to_start_of_next_block(count)
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
@cmdutils.argument('count', count=True)
def move_to_start_of_prev_block(self, count=1):
"""Move the cursor or selection to the start of previous block.
@ -1961,8 +1953,8 @@ class CommandDispatcher:
"""
self._current_widget().caret.move_to_start_of_prev_block(count)
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
@cmdutils.argument('count', count=True)
def move_to_end_of_next_block(self, count=1):
"""Move the cursor or selection to the end of next block.
@ -1972,8 +1964,8 @@ class CommandDispatcher:
"""
self._current_widget().caret.move_to_end_of_next_block(count)
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
@cmdutils.argument('count', count=True)
def move_to_end_of_prev_block(self, count=1):
"""Move the cursor or selection to the end of previous block.
@ -1983,26 +1975,26 @@ class CommandDispatcher:
"""
self._current_widget().caret.move_to_end_of_prev_block(count)
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
def move_to_start_of_document(self):
"""Move the cursor or selection to the start of the document."""
self._current_widget().caret.move_to_start_of_document()
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
def move_to_end_of_document(self):
"""Move the cursor or selection to the end of the document."""
self._current_widget().caret.move_to_end_of_document()
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
def toggle_selection(self):
"""Toggle caret selection mode."""
self._current_widget().caret.toggle_selection()
@cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window')
@cmdutils.register(instance='command-dispatcher', modes=[KeyMode.caret],
scope='window')
def drop_selection(self):
"""Drop selection and keep selection mode enabled."""
self._current_widget().caret.drop_selection()
@ -2145,8 +2137,7 @@ class CommandDispatcher:
ed.edit(url or old_url)
@cmdutils.register(instance='command-dispatcher', scope='window',
hide=True)
@cmdutils.register(instance='command-dispatcher', scope='window')
def set_mark(self, key):
"""Set a mark at the current scroll position in the current tab.
@ -2155,8 +2146,7 @@ class CommandDispatcher:
"""
self._tabbed_browser.set_mark(key)
@cmdutils.register(instance='command-dispatcher', scope='window',
hide=True)
@cmdutils.register(instance='command-dispatcher', scope='window')
def jump_mark(self, key):
"""Jump to the mark named by `key`.

View File

@ -902,7 +902,7 @@ class HintManager(QObject):
except HintingError as e:
message.error(str(e))
@cmdutils.register(instance='hintmanager', scope='tab', hide=True,
@cmdutils.register(instance='hintmanager', scope='tab',
modes=[usertypes.KeyMode.hint])
def follow_hint(self, keystring=None):
"""Follow a hint.

View File

@ -58,7 +58,6 @@ class Command:
name: The main name of the command.
maxsplit: The maximum amount of splits to do for the commandline, or
None.
hide: Whether to hide the arguments or not.
deprecated: False, or a string to describe why a command is deprecated.
desc: The description of the command.
handler: The handler function to call.
@ -69,39 +68,37 @@ class Command:
backend: Which backend the command works with (or None if it works with
both)
no_replace_variables: Don't replace variables like {url}
modes: The modes the command can be executed in.
_qute_args: The saved data from @cmdutils.argument
_modes: The modes the command can be executed in.
_count: The count set for the command.
_instance: The object to bind 'self' to.
_scope: The scope to get _instance for in the object registry.
"""
def __init__(self, *, handler, name, instance=None, maxsplit=None,
hide=False, modes=None, not_modes=None, debug=False,
deprecated=False, no_cmd_split=False,
star_args_optional=False, scope='global', backend=None,
no_replace_variables=False):
modes=None, not_modes=None, debug=False, deprecated=False,
no_cmd_split=False, star_args_optional=False, scope='global',
backend=None, no_replace_variables=False):
if modes is not None and not_modes is not None:
raise ValueError("Only modes or not_modes can be given!")
if modes is not None:
for m in modes:
if not isinstance(m, usertypes.KeyMode):
raise TypeError("Mode {} is no KeyMode member!".format(m))
self._modes = set(modes)
self.modes = set(modes)
elif not_modes is not None:
for m in not_modes:
if not isinstance(m, usertypes.KeyMode):
raise TypeError("Mode {} is no KeyMode member!".format(m))
self._modes = set(usertypes.KeyMode).difference(not_modes)
self.modes = set(usertypes.KeyMode).difference(not_modes)
else:
self._modes = set(usertypes.KeyMode)
self.modes = set(usertypes.KeyMode)
if scope != 'global' and instance is None:
raise ValueError("Setting scope without setting instance makes "
"no sense!")
self.name = name
self.maxsplit = maxsplit
self.hide = hide
self.deprecated = deprecated
self._instance = instance
self._scope = scope
@ -508,8 +505,8 @@ class Command:
Args:
mode: The usertypes.KeyMode to check.
"""
if mode not in self._modes:
mode_names = '/'.join(sorted(m.name for m in self._modes))
if mode not in self.modes:
mode_names = '/'.join(sorted(m.name for m in self.modes))
raise cmdexc.PrerequisitesError(
"{}: This command is only allowed in {} mode, not {}.".format(
self.name, mode_names, mode.name))

View File

@ -222,7 +222,7 @@ class CompletionView(QTreeView):
self.scrollTo(idx)
return idx.child(0, 0)
@cmdutils.register(instance='completion', hide=True,
@cmdutils.register(instance='completion',
modes=[usertypes.KeyMode.command], scope='window')
@cmdutils.argument('which', choices=['next', 'prev', 'next-category',
'prev-category'])
@ -369,7 +369,7 @@ class CompletionView(QTreeView):
scrollbar.setValue(scrollbar.minimum())
super().showEvent(e)
@cmdutils.register(instance='completion', hide=True,
@cmdutils.register(instance='completion',
modes=[usertypes.KeyMode.command], scope='window')
def completion_item_del(self):
"""Delete the current completion item."""
@ -378,7 +378,7 @@ class CompletionView(QTreeView):
raise cmdexc.CommandError("No item selected!")
self.model().delete_cur_item(index)
@cmdutils.register(instance='completion', hide=True,
@cmdutils.register(instance='completion',
modes=[usertypes.KeyMode.command], scope='window')
def completion_item_yank(self, sel=False):
"""Yank the current completion item into the clipboard.

View File

@ -19,7 +19,7 @@
"""Utility functions for completion models."""
from qutebrowser.utils import objreg
from qutebrowser.utils import objreg, usertypes
from qutebrowser.commands import cmdutils
@ -28,7 +28,7 @@ def get_cmd_completions(info, include_hidden, include_aliases, prefix=''):
Args:
info: The CompletionInfo.
include_hidden: True to include commands annotated with hide=True.
include_hidden: Include commands which are not in normal mode.
include_aliases: True to include command aliases.
prefix: String to append to the command name.
@ -39,8 +39,9 @@ def get_cmd_completions(info, include_hidden, include_aliases, prefix=''):
cmd_to_keys = info.keyconf.get_reverse_bindings_for('normal')
for obj in set(cmdutils.cmd_dict.values()):
hide_debug = obj.debug and not objreg.get('args').debug
hide_hidden = obj.hide and not include_hidden
if not (hide_debug or hide_hidden or obj.deprecated):
hide_mode = (usertypes.KeyMode.normal not in obj.modes and
not include_hidden)
if not (hide_debug or hide_mode or obj.deprecated):
bindings = ', '.join(cmd_to_keys.get(obj.name, []))
cmdlist.append((prefix + obj.name, obj.desc, bindings))

View File

@ -251,7 +251,7 @@ class ModeManager(QObject):
self.mode = mode
self.entered.emit(mode, self._win_id)
@cmdutils.register(instance='mode-manager', hide=True, scope='window')
@cmdutils.register(instance='mode-manager', scope='window')
def enter_mode(self, mode):
"""Enter a key mode.
@ -301,8 +301,7 @@ class ModeManager(QObject):
self.left.emit(mode, self.mode, self._win_id)
@cmdutils.register(instance='mode-manager', name='leave-mode',
not_modes=[usertypes.KeyMode.normal], hide=True,
scope='window')
not_modes=[usertypes.KeyMode.normal], scope='window')
def leave_current_mode(self):
"""Leave the mode we're currently in."""
if self.mode == usertypes.KeyMode.normal:
@ -328,7 +327,7 @@ class ModeManager(QObject):
else:
return self._eventFilter_keyrelease(event)
@cmdutils.register(instance='mode-manager', scope='window', hide=True)
@cmdutils.register(instance='mode-manager', scope='window')
def clear_keychain(self):
"""Clear the currently entered key chain."""
self._parsers[self.mode].clear_keystring()

View File

@ -364,7 +364,7 @@ class PromptContainer(QWidget):
widget.hide()
widget.deleteLater()
@cmdutils.register(instance='prompt-container', hide=True, scope='window',
@cmdutils.register(instance='prompt-container', scope='window',
modes=[usertypes.KeyMode.prompt,
usertypes.KeyMode.yesno])
def prompt_accept(self, value=None):
@ -388,7 +388,7 @@ class PromptContainer(QWidget):
message.global_bridge.prompt_done.emit(self._prompt.KEY_MODE)
question.done()
@cmdutils.register(instance='prompt-container', hide=True, scope='window',
@cmdutils.register(instance='prompt-container', scope='window',
modes=[usertypes.KeyMode.prompt], maxsplit=0)
def prompt_open_download(self, cmdline: str = None):
"""Immediately open a download.
@ -407,7 +407,7 @@ class PromptContainer(QWidget):
except UnsupportedOperationError:
pass
@cmdutils.register(instance='prompt-container', hide=True, scope='window',
@cmdutils.register(instance='prompt-container', scope='window',
modes=[usertypes.KeyMode.prompt])
@cmdutils.argument('which', choices=['next', 'prev'])
def prompt_item_focus(self, which):

View File

@ -124,7 +124,7 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
else:
self.set_cmd_text(text)
@cmdutils.register(instance='status-command', hide=True,
@cmdutils.register(instance='status-command',
modes=[usertypes.KeyMode.command], scope='window')
def command_history_prev(self):
"""Go back in the commandline history."""
@ -139,7 +139,7 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
if item:
self.set_cmd_text(item)
@cmdutils.register(instance='status-command', hide=True,
@cmdutils.register(instance='status-command',
modes=[usertypes.KeyMode.command], scope='window')
def command_history_next(self):
"""Go forward in the commandline history."""
@ -152,7 +152,7 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
if item:
self.set_cmd_text(item)
@cmdutils.register(instance='status-command', hide=True,
@cmdutils.register(instance='status-command',
modes=[usertypes.KeyMode.command], scope='window')
def command_accept(self):
"""Execute the command currently in the commandline."""

View File

@ -48,7 +48,7 @@ class ReadlineBridge:
else:
return None
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_backward_char(self):
"""Move back a character.
@ -60,7 +60,7 @@ class ReadlineBridge:
return
widget.cursorBackward(False)
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_forward_char(self):
"""Move forward a character.
@ -72,7 +72,7 @@ class ReadlineBridge:
return
widget.cursorForward(False)
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_backward_word(self):
"""Move back to the start of the current or previous word.
@ -84,7 +84,7 @@ class ReadlineBridge:
return
widget.cursorWordBackward(False)
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_forward_word(self):
"""Move forward to the end of the next word.
@ -96,7 +96,7 @@ class ReadlineBridge:
return
widget.cursorWordForward(False)
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_beginning_of_line(self):
"""Move to the start of the line.
@ -108,7 +108,7 @@ class ReadlineBridge:
return
widget.home(False)
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_end_of_line(self):
"""Move to the end of the line.
@ -120,7 +120,7 @@ class ReadlineBridge:
return
widget.end(False)
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_unix_line_discard(self):
"""Remove chars backward from the cursor to the beginning of the line.
@ -134,7 +134,7 @@ class ReadlineBridge:
self._deleted[widget] = widget.selectedText()
widget.del_()
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_kill_line(self):
"""Remove chars from the cursor to the end of the line.
@ -173,7 +173,7 @@ class ReadlineBridge:
self._deleted[widget] = widget.selectedText()
widget.del_()
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_unix_word_rubout(self):
"""Remove chars from the cursor to the beginning of the word.
@ -183,7 +183,7 @@ class ReadlineBridge:
"""
self._rubout([' '])
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_unix_filename_rubout(self):
"""Remove chars from the cursor to the previous path separator.
@ -192,7 +192,7 @@ class ReadlineBridge:
"""
self._rubout([' ', '/'])
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_backward_kill_word(self):
"""Remove chars from the cursor to the beginning of the word.
@ -207,7 +207,7 @@ class ReadlineBridge:
self._deleted[widget] = widget.selectedText()
widget.del_()
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_kill_word(self):
"""Remove chars from the cursor to the end of the current word.
@ -221,7 +221,7 @@ class ReadlineBridge:
self._deleted[widget] = widget.selectedText()
widget.del_()
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_yank(self):
"""Paste the most recently deleted text.
@ -233,7 +233,7 @@ class ReadlineBridge:
return
widget.insert(self._deleted[widget])
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_delete_char(self):
"""Delete the character after the cursor.
@ -245,7 +245,7 @@ class ReadlineBridge:
return
widget.del_()
@cmdutils.register(instance='readline-bridge', hide=True,
@cmdutils.register(instance='readline-bridge',
modes=[typ.KeyMode.command, typ.KeyMode.prompt])
def rl_backward_delete_char(self):
"""Delete the character before the cursor.

View File

@ -87,8 +87,7 @@ def repeat(times: int, command, win_id):
commandrunner.run_safely(command)
@cmdutils.register(maxsplit=1, hide=True, no_cmd_split=True,
no_replace_variables=True)
@cmdutils.register(maxsplit=1, no_cmd_split=True, no_replace_variables=True)
@cmdutils.argument('win_id', win_id=True)
@cmdutils.argument('count', count=True)
def run_with_count(count_arg: int, command, win_id, count=1):
@ -104,7 +103,7 @@ def run_with_count(count_arg: int, command, win_id, count=1):
runners.CommandRunner(win_id).run(command, count_arg * count)
@cmdutils.register(hide=True)
@cmdutils.register()
def message_error(text):
"""Show an error message in the statusbar.
@ -114,7 +113,7 @@ def message_error(text):
message.error(text)
@cmdutils.register(hide=True)
@cmdutils.register()
@cmdutils.argument('count', count=True)
def message_info(text, count=1):
"""Show an info message in the statusbar.
@ -127,7 +126,7 @@ def message_info(text, count=1):
message.info(text)
@cmdutils.register(hide=True)
@cmdutils.register()
def message_warning(text):
"""Show a warning message in the statusbar.
@ -137,7 +136,7 @@ def message_warning(text):
message.warning(text)
@cmdutils.register(hide=True)
@cmdutils.register()
def clear_messages():
"""Clear all message notifications."""
message.global_bridge.clear_messages.emit()
@ -265,7 +264,7 @@ def debug_set_fake_clipboard(s=None):
utils.fake_clipboard = s
@cmdutils.register(hide=True)
@cmdutils.register()
@cmdutils.argument('win_id', win_id=True)
@cmdutils.argument('count', count=True)
def repeat_command(win_id, count=None):
@ -347,7 +346,7 @@ def window_only(current_win_id):
window.close()
@cmdutils.register(hide=True)
@cmdutils.register()
def nop():
"""Do nothing."""
return

View File

@ -347,19 +347,19 @@ def generate_commands(filename):
f.write("= Commands\n\n")
f.write(commands.__doc__)
normal_cmds = []
hidden_cmds = []
other_cmds = []
debug_cmds = []
for name, cmd in cmdutils.cmd_dict.items():
if cmd.deprecated:
continue
if cmd.hide:
hidden_cmds.append((name, cmd))
if usertypes.KeyMode.normal not in cmd.modes:
other_cmds.append((name, cmd))
elif cmd.debug:
debug_cmds.append((name, cmd))
else:
normal_cmds.append((name, cmd))
normal_cmds.sort()
hidden_cmds.sort()
other_cmds.sort()
debug_cmds.sort()
f.write("\n")
f.write("== Normal commands\n")
@ -368,10 +368,10 @@ def generate_commands(filename):
for name, cmd in normal_cmds:
f.write(_get_command_doc(name, cmd))
f.write("\n")
f.write("== Hidden commands\n")
f.write("== Commands not usable in normal mode\n")
f.write(".Quick reference\n")
f.write(_get_command_quickref(hidden_cmds) + '\n')
for name, cmd in hidden_cmds:
f.write(_get_command_quickref(other_cmds) + '\n')
for name, cmd in other_cmds:
f.write(_get_command_doc(name, cmd))
f.write("\n")
f.write("== Debugging commands\n")

View File

@ -338,6 +338,7 @@ class FakeCommand:
completion = attr.ib(None)
maxsplit = attr.ib(None)
takes_count = attr.ib(lambda: False)
modes = attr.ib((usertypes.KeyMode.normal, ))
class FakeTimer(QObject):

View File

@ -142,14 +142,6 @@ class TestRegister:
pass
assert cmdutils.cmd_dict['fun']._instance == 'foobar'
def test_kwargs(self):
"""Make sure the other keyword arguments get passed to Command."""
@cmdutils.register(hide=True)
def fun():
"""Blah."""
pass
assert cmdutils.cmd_dict['fun'].hide
def test_star_args(self):
"""Check handling of *args."""
@cmdutils.register()

View File

@ -68,9 +68,10 @@ def cmdutils_stub(monkeypatch, stubs):
'quit': stubs.FakeCommand(name='quit', desc='quit qutebrowser'),
'open': stubs.FakeCommand(name='open', desc='open a url'),
'prompt-yes': stubs.FakeCommand(name='prompt-yes', deprecated=True),
'scroll': stubs.FakeCommand(name='scroll',
'scroll': stubs.FakeCommand(
name='scroll',
desc='Scroll the current tab in the given direction.',
hide=True),
modes=()),
})