doc/_ext/ceph_commands: handle non-positional args in docs

Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Sage Weil 2021-05-25 10:53:01 -04:00
parent c70a4f583c
commit 295a5f2827

View File

@ -82,7 +82,7 @@ class CmdParam(object):
def __init__(self, type, name,
who=None, n=None, req=True, range=None, strings=None,
goodchars=None):
goodchars=None, positional=True):
self.type = type
self.name = name
self.who = who
@ -91,6 +91,7 @@ class CmdParam(object):
self.range = range.split('|') if range else []
self.strings = strings.split('|') if strings else []
self.goodchars = goodchars
self.positional = positional != 'false'
assert who == None
@ -200,7 +201,7 @@ TEMPLATE = '''
{%- if command.params %}
:Parameters:{% for param in command.params -%}
{{" -" | indent(12, not loop.first) }} **{{param.name}}**: {{ param.help() }}
{{" -" | indent(12, not loop.first) }} **{% if param.positional %}{{param.name}}{% else %}--{{param.name}}{% endif %}**: {{ param.help() }}
{% endfor %}
{% endif %}
:Ceph Module: {{ command.module }}