diff --git a/aio/src/styles/2-modules/_cli-pages.scss b/aio/src/styles/2-modules/_cli-pages.scss index a8462aa91b..7f1c9b7018 100644 --- a/aio/src/styles/2-modules/_cli-pages.scss +++ b/aio/src/styles/2-modules/_cli-pages.scss @@ -1,7 +1,8 @@ -.cli-name, .cli-default { +.cli-name { font-weight: bold; } .cli-option-syntax { white-space: pre; } + diff --git a/aio/tools/transforms/templates/cli/lib/cli.html b/aio/tools/transforms/templates/cli/lib/cli.html index fccf02bcf1..2658791fa3 100644 --- a/aio/tools/transforms/templates/cli/lib/cli.html +++ b/aio/tools/transforms/templates/cli/lib/cli.html @@ -53,16 +53,12 @@ {% for option in options %} - {% for type in option.types -%} - {% for alias in option.names -%} - {$ renderOption(option.name, alias, type, option.default, option.enum) $} - {% if not loop.last %}
{% endif %} - {% endfor -%} - {% if not loop.last %}
{% endif %} - {% endfor -%} + {$ renderOption(option.name, option.type, option.default, option.enum) $} {$ 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 %} {% endfor %} @@ -71,26 +67,23 @@ {% endif %} {% endmacro %} -{% macro bold(isBold, contents) -%} -{$ contents $} -{%- endmacro -%} +{%- macro renderOptionName(name) -%} +{% if name.length > 1 %}-{% endif %}-{$ name $} +{%- endmacro %} {%- macro renderValues(values, default) -%} -{% for value in values %}{$ bold(value==default, value) $}{% if not loop.last %}|{% endif %}{% endfor %} +{$ values.join('|') $} {%- endmacro -%} -{%- macro renderOption(name, alias, type, default, values) -%} -{% set prefix = '--' if (name === alias and name.length > 1) else '-' %} -{%- if type === 'boolean' -%} -{%- if not values.length %}{$ prefix $}{$ alias $}={$ renderValues([true, false], default) $} -{% endif -%} -{$ prefix $}{$ bold(default, alias) $}|{$ prefix $}{$ bold(not default, alias | cliNegate) $} +{%- 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 $}{$ alias $}={$ renderValues(values, default) $} +{$ prefix $}{$ name $}={$ renderValues(values, default) $} {%- elif type === 'string' -%} -{$ prefix $}{$ alias $}={$ name $} +{$ name $} {%- else -%} -{$ prefix $}{$ alias $} +{$ prefix $}{$ name $} {%- endif -%} {%- endmacro -%}