From ede13c76d9cbae4134119bc05e60ba0d0930e598 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 3 Dec 2018 08:44:35 +0100 Subject: [PATCH] Fix checking for count in src2asciidoc --- qutebrowser/commands/command.py | 8 +++++--- scripts/dev/src2asciidoc.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/qutebrowser/commands/command.py b/qutebrowser/commands/command.py index 4d0d4af92..8d2f5ad57 100644 --- a/qutebrowser/commands/command.py +++ b/qutebrowser/commands/command.py @@ -71,6 +71,10 @@ class Command: _scope: The scope to get _instance for in the object registry. """ + # CommandValue values which need a count + COUNT_COMMAND_VALUES = [usertypes.CommandValue.count, + usertypes.CommandValue.count_tab] + def __init__(self, *, handler, name, instance=None, maxsplit=None, modes=None, not_modes=None, debug=False, deprecated=False, no_cmd_split=False, star_args_optional=False, scope='global', @@ -554,9 +558,7 @@ class Command: def takes_count(self): """Return true iff this command can take a count argument.""" - count_values = [usertypes.CommandValue.count, - usertypes.CommandValue.count_tab] - return any(info.value in count_values + return any(info.value in self.COUNT_COMMAND_VALUES for info in self._qute_args.values()) def register(self): diff --git a/scripts/dev/src2asciidoc.py b/scripts/dev/src2asciidoc.py index ad1397d82..f7b1d46cd 100755 --- a/scripts/dev/src2asciidoc.py +++ b/scripts/dev/src2asciidoc.py @@ -252,7 +252,7 @@ def _get_command_doc_count(cmd, parser): Strings which should be added to the docs. """ for param in inspect.signature(cmd.handler).parameters.values(): - if cmd.get_arg_info(param).count: + if cmd.get_arg_info(param).value in cmd.COUNT_COMMAND_VALUES: yield "" yield "==== count" try: