From 38c341e3ea4c0feb89e91085111563ff37aa25de Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 13 Sep 2014 00:33:15 +0200 Subject: [PATCH] Add count info in commands. --- doc/help/commands.asciidoc | 61 ++++++++++++++++++++++++++++++++ qutebrowser/browser/downloads.py | 6 +++- scripts/generate_doc.py | 5 +++ 3 files changed, 71 insertions(+), 1 deletion(-) diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index bbaf2f97d..682bb85c3 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -51,6 +51,9 @@ === back Go back in the history of the current tab. +==== count +How many pages to go back. + [[bind]] === bind Syntax: +:bind 'key' 'command' ['mode']+ @@ -67,6 +70,9 @@ Bind a key to a command. === cancel-download Cancel the first/[count]th download. +==== count +The index of the download to cancel. + [[download-page]] === download-page Download the current page. @@ -75,6 +81,9 @@ Download the current page. === forward Go forward in the history of the current tab. +==== count +How many pages to go forward. + [[get]] === get Syntax: +:get 'section' 'option'+ @@ -183,6 +192,9 @@ Open a URL in the current/[count]th tab. * +*-b*+, +*--bg*+: Open in a new background tab. * +*-t*+, +*--tab*+: Open in a new tab. +==== count +The tab index to open the URL in, or None. + [[paste]] === paste Syntax: +:paste [*--sel*] [*--tab*] [*--bg*]+ @@ -214,6 +226,9 @@ Print the current/[count]th tab. ==== optional arguments * +*-p*+, +*--preview*+: Show preview instead of printing. +==== count +The tab index to print, or None. + [[quickmark-add]] === quickmark-add Syntax: +:quickmark-add 'url' 'name'+ @@ -249,6 +264,9 @@ Quit qutebrowser. === reload Reload the current/[count]th tab. +==== count +The tab index to reload, or None. + [[report]] === report Report a bug in qutebrowser. @@ -309,10 +327,16 @@ Note the {url} variable which gets replaced by the current URL might be useful h === stop Stop loading in the current/[count]th tab. +==== count +The tab index to stop, or None. + [[tab-close]] === tab-close Close the current/[count]th tab. +==== count +The tab index to close, or None + [[tab-focus]] === tab-focus Syntax: +:tab-focus ['index']+ @@ -323,6 +347,9 @@ Select the tab given as argument/[count]. * +'index'+: The tab index to focus, starting with 1. The special value `last` focuses the last focused tab. +==== count +The tab index to focus, starting with 1. + [[tab-move]] === tab-move Syntax: +:tab-move ['direction']+ @@ -333,10 +360,17 @@ Move the current tab. * +'direction'+: `+` or `-` for relative moving, not given for absolute moving. +==== count +If moving absolutely: New position (default: 0) If moving relatively: Offset. + + [[tab-next]] === tab-next Switch to the next tab, or switch [count] tabs forward. +==== count +How many tabs to switch forward. + [[tab-only]] === tab-only Close all tabs except for the current one. @@ -345,6 +379,9 @@ Close all tabs except for the current one. === tab-prev Switch to the previous tab, or switch [count] tabs back. +==== count +How many tabs to switch back. + [[unbind]] === unbind Syntax: +:unbind 'key' ['mode']+ @@ -381,14 +418,23 @@ The zoom can be given as argument or as [count]. If neither of both is given, th ==== positional arguments * +'zoom'+: The zoom percentage to set. +==== count +The zoom percentage to set. + [[zoom-in]] === zoom-in Increase the zoom level for the current tab. +==== count +How many steps to zoom in. + [[zoom-out]] === zoom-out Decrease the zoom level for the current tab. +==== count +How many steps to zoom out. + == Hidden commands .Quick reference @@ -569,6 +615,9 @@ Scroll the current tab by 'count * dx/dy'. * +'dx'+: How much to scroll in x-direction. * +'dy'+: How much to scroll in x-direction. +==== count +multiplier + [[scroll-page]] === scroll-page Syntax: +:scroll-page 'x' 'y'+ @@ -579,6 +628,9 @@ Scroll the frame page-wise. * +'x'+: How many pages to scroll to the right. * +'y'+: How many pages to scroll down. +==== count +multiplier + [[scroll-perc]] === scroll-perc Syntax: +:scroll-perc [*--horizontal*] ['perc']+ @@ -593,14 +645,23 @@ The percentage can be given either as argument or as count. If no percentage is ==== 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. + == Debugging commands These commands are mainly intended for debugging. They are hidden if qutebrowser was started without the `--debug`-flag. diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index 2c7f9129d..3623be224 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -359,7 +359,11 @@ class DownloadManager(QObject): @cmdutils.register(instance='downloadmanager') def cancel_download(self, count=1): - """Cancel the first/[count]th download.""" + """Cancel the first/[count]th download. + + Args: + count: The index of the download to cancel. + """ if count == 0: return try: diff --git a/scripts/generate_doc.py b/scripts/generate_doc.py index cee4bcdda..c292e45fd 100755 --- a/scripts/generate_doc.py +++ b/scripts/generate_doc.py @@ -181,6 +181,11 @@ def _get_command_doc(name, cmd): raise KeyError("No description for arg {} of command " "'{}'!".format(e, cmd.name)) + if cmd.count: + output.append("") + output.append("==== count") + output.append(parser.arg_descs['count']) + output.append("") output.append("") return '\n'.join(output)