usage-lib 3.2.0

Library for working with usage specs
Documentation
{%- if cmd.before_help %}{{ cmd.before_help }}

{% elif spec.before_help %}{{ spec.before_help }}

{% endif -%}
{%- if spec.name and spec.version %}{{ spec.name }} {{ spec.version }}
{% elif spec.version %}{{ spec.bin }} {{ spec.version }}
{% endif -%}
{%- if spec.about %}{{ spec.about }}

{% endif -%}
Usage: {{ spec.bin ~ " " ~ cmd.usage | trim }}

{%- if cmd.subcommands %}

Commands:
{%- for name, cmd in cmd.subcommands %}
  {{ cmd.usage | trim }}
{%- if cmd.deprecated %} [deprecated: {{ cmd.deprecated }}]{%- endif %}
{%- if cmd.aliases %} [aliases: {{ cmd.aliases | join(sep=", ") }}]{% endif %}
{%- if cmd.help %}  {{ cmd.help }}{%- endif %}
{%- endfor %}
  help  Print this message or the help of the given subcommand(s)
{%- endif %}

{%- if cmd.args %}

Arguments:
{%- for arg in cmd.args %}
  {{ arg.usage | trim }}
{%- if arg.help %}  {{ arg.help }}{%- endif %}
{%- if arg.choices and arg.choices.choices %} [{{ arg.choices.choices | join(sep=", ") }}]{%- endif %}
{%- if arg.choices and arg.choices.env %} [choices env: {{ arg.choices.env }}]{%- endif %}
{%- if arg.env %} [env: {{ arg.env }}]{%- endif %}
{%- if arg.default %} (default: {{ arg.default | join(sep=", ") }}){%- endif %}
{%- endfor %}
{%- endif %}

{%- if cmd.flags %}

Flags:
{%- for flag in cmd.flags %}
  {{ flag.usage | trim }}
{%- if flag.aliases %}  [aliases: {{ flag.aliases | join(sep=", ") }}]{% endif %}
{%- if flag.help %}  {{ flag.help }}{%- endif %}
{%- if flag.arg.choices and flag.arg.choices.choices %} [{{ flag.arg.choices.choices | join(sep=", ") }}]{%- endif %}
{%- if flag.arg.choices and flag.arg.choices.env %} [choices env: {{ flag.arg.choices.env }}]{%- endif %}
{%- if flag.env %} [env: {{ flag.env }}]{%- endif %}
{%- endfor %}
{%- endif %}

{%- if cmd.examples %}

Examples:
{%- for example in cmd.examples %}
{%- if example.header %}
  {{ example.header }}:
{%- endif %}
    $ {{ example.code }}
{%- endfor %}
{%- elif spec.examples %}

Examples:
{%- for example in spec.examples %}
{%- if example.header %}
  {{ example.header }}:
{%- endif %}
    $ {{ example.code }}
{%- endfor %}
{%- endif %}

{%- if cmd.after_help %}

{{ cmd.after_help }}
{%- elif spec.after_help %}

{{ spec.after_help }}
{%- endif -%}