{% macro renderSyntax(container, prefix) -%} {% for name in container.names %} ng {%if prefix %}{$ prefix $} {% endif %}{$ name $} {%- for arg in container.positionalOptions %} <{$ arg.name $}>{% endfor %} {%- if container.namedOptions.length %} [options]{% endif -%} {% endfor %} {% endmacro %} {% macro renderArguments(arguments, level = 2) %} {% if arguments.length %} Arguments {% for option in arguments %} {% endfor %}
Argument Description Value Type
<{$ option.name $}> {$ option.description | marked $} {% if option.subcommands.length -%}

This option can take one of the following sub-commands:

{%- endif %}
{% if option.enum.length > 0 %}{$ renderValues(option.enum) $}{% else %}string{% endif %}
{% endif %} {% endmacro %} {% macro renderNamedOptions(options, level = 2) %} {% if options.length %} Options {% for option in options %} {% endfor %}
Option Description Value Type Default Value
{$ renderOptionName(option.name) $} {% if option.deprecated %} {% if option.deprecated === true %}

Deprecated

{% else %} {$ ('**Deprecated:** ' + option.deprecated) | marked $} {% endif %} {% endif %} {$ option.description | marked $} {% 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 %}
{% endif %} {% endmacro %} {%- macro renderOptionName(name) -%} {% if name.length > 1 %}-{% endif %}-{$ name $} {%- endmacro %} {%- macro renderValues(values) -%} {$ values.join('|') $} {%- endmacro -%} {%- macro renderOptionValues(type, values) -%} {%- if values.length -%} {$ renderValues(values) $} {%- else -%} {$ type $} {%- endif -%} {%- endmacro -%} {%- macro renderSubcommands(container) -%} {% for command in container.positionalOptions %}{% if command.subcommands.length %}

{$ command.name | title $} commands

{% for subcommand in command.subcommands %}

{$ subcommand.name $}

{% for name in container.names %} {$ renderSyntax(subcommand, name) $} {% endfor %} {$ subcommand.description | marked $} {# for now we assume that commands do not have further sub-commands #} {$ renderArguments(subcommand.positionalOptions, 4) $} {$ renderNamedOptions(subcommand.namedOptions, 4) $} {% endfor %} {% endif %}{% endfor %} {%- endmacro -%}