Fix checking for count in src2asciidoc
This commit is contained in:
parent
ef5e5d84ac
commit
ede13c76d9
@ -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):
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user