{% macro renderSyntax(container, prefix) -%} {% for usage in container.usages %} {$ usage $} {% 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.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 and option.default !== '' %}{$ 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) -%} {% if container.subcommands.length %}

{$ container.name | title $} commands

{% for subcommand in container.subcommands %}

{$ subcommand.name $}

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