From 044cd52996283d2b713b189a0c428ec2d8c7b77f Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 9 Dec 2020 13:09:14 +0100 Subject: [PATCH] docs: update CLI MAN page format (#40038) With this change we update the CLI docs template to seperate the following the default and value types from the argument field. This should make it clearer and more understandable PR Close #40038 --- .../transforms/templates/cli/lib/cli.html | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/aio/tools/transforms/templates/cli/lib/cli.html b/aio/tools/transforms/templates/cli/lib/cli.html index ba1b1ffd77..99dca56305 100644 --- a/aio/tools/transforms/templates/cli/lib/cli.html +++ b/aio/tools/transforms/templates/cli/lib/cli.html @@ -13,14 +13,15 @@ - - + + + {% for option in arguments %} - + + {% endfor %} @@ -45,15 +47,17 @@
ArgumentDescriptionArgumentDescriptionValue Type
<{$ option.name $}>{% if option.enum.length > 0 %}={$ renderValues(option.enum) $}{% endif %}<{$ option.name $}> {$ option.description | marked $} {% if option.subcommands.length -%} @@ -32,6 +33,7 @@ {%- endif %} {% if option.enum.length > 0 %}{$ renderValues(option.enum) $}{% else %}string{% endif %}
- - - + + + + + {% for option in options %} + + {% endfor %} @@ -78,20 +83,15 @@ {% if name.length > 1 %}-{% endif %}-{$ name $} {%- endmacro %} -{%- macro renderValues(values, default) -%} -{%- set valString = values.join('|') -%} -{%- if valString.length > 15 %}
{% endif %}{$ valString $} +{%- macro renderValues(values) -%} +{$ values.join('|') $} {%- endmacro -%} -{%- macro renderOption(name, type, default, values) -%} -{% set prefix = '--' if name.length > 1 else '-' %} -{%- if type === 'boolean' and not values.length %}{$ prefix $}{$ name $}={$ renderValues([true, false], default) $} -{%- elif values.length -%} -{$ prefix $}{$ name $}={$ renderValues(values, default) $} -{%- elif type === 'string' -%} -{$ prefix $}{$ name $}={% if name.length > 15 %}
{% endif %}{$ name $} +{%- macro renderOptionValues(type, values) -%} +{%- if values.length -%} +{$ renderValues(values) $} {%- else -%} -{$ prefix $}{$ name $} +{$ type $} {%- endif -%} {%- endmacro -%}
OptionDescription
OptionDescriptionValue TypeDefault Value
- {$ renderOption(option.name, option.type, option.default, option.enum) $} + {$ renderOptionName(option.name) $} {% if option.deprecated %} @@ -64,9 +68,10 @@ {% endif %} {% endif %} {$ option.description | marked $} - {% if option.default !== undefined %}

Default: {$ option.default $}

{% endif %} {% if option.aliases.length %}

Aliases: {% for alias in option.aliases %}{$ renderOptionName(alias) $}{% if not loop.last %}, {% endif %}{% endfor %}

{% endif %}
{$ renderOptionValues(option.type, option.enum) $}{% if option.default !== undefined %}{$ option.default $}{% endif %}