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 %}