usage-lib 3.2.0

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

{% elif cmd.before_help %}{{ cmd.before_help }}

{% elif spec.before_help_long %}{{ spec.before_help_long }}

{% 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_long %}{{ spec.about_long }}

{% elif 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 %}
{%- set help = cmd.help_long | default(value=cmd.help | default(value='')) %}
{%- if help %}
    {{ help | indent(width=4) }}
{%- endif %}
{% endfor %}
  help
    Print this message or the help of the given subcommand(s)
{%- endif %}

{%- if cmd.args %}

Arguments:
{%- for arg in cmd.args %}
{%- if arg.help_rendered %}
  {{ arg.usage | ljust(width=arg.usage_col_width) }}  {{ arg.help_rendered }}
{%- if arg.help_is_multiline %}

{%- endif %}
{%- else %}
  {{ arg.usage | trim }}
{%- set help = arg.help_long | default(value=arg.help | default(value='')) %}
{%- if help %}
    {{ help | indent(width=2) }}
{%- endif %}
{%- endif %}
{%- if arg.choices and arg.choices.choices %}
    [possible values: {{ 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 %}
{%- if flag.help_rendered %}
  {{ flag.usage | ljust(width=flag.usage_col_width) }}  {{ flag.help_rendered }}
{%- if flag.help_is_multiline %}

{%- endif %}
{%- else %}
  {{ flag.usage | trim }}
{%- if flag.aliases %}  [aliases: {{ flag.aliases | join(sep=", ") }}]{% endif %}
{%- set help = flag.help_long | default(value=flag.help | default(value='')) %}
{%- if help %}
    {{ help | indent(width=2) }}
{%- endif %}
{%- endif %}
{%- if flag.arg.choices and flag.arg.choices.choices %}
    [possible values: {{ 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 %}
{%- if example.help %}
    {{ example.help }}
{%- endif %}
    $ {{ example.code }}
{%- endfor %}
{%- elif spec.examples %}

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

{%- if cmd.after_help_long %}

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

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

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

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

{%- if spec.author or spec.license %}
{% if spec.author %}
Author: {{ spec.author }}
{%- endif %}
{%- if spec.license %}
License: {{ spec.license }}
{%- endif %}
{%- endif -%}