usage-lib 2.0.6

Library for working with usage specs
Documentation
{%- set source_code_link = source_code_link(spec=spec, cmd=cmd) %}
{%- set full_cmd = cmd.full_cmd | join(sep=" ") %}
{%- if multi -%}
{{- "#" | repeat(count=header_level) }} `{{ spec.bin ~ " " ~ full_cmd | trim }}`
{%- endif %}
{%- if cmd.before_help_md %}

{{ cmd.before_help_md | escape_md }}
{%- endif %}

- **Usage**: `{{ spec.bin ~ " " ~ cmd.usage | trim }}`
{%- if cmd.aliases %}
- **Aliases**: `{{ cmd.aliases | join(sep="`, `") }}`
{%- endif %}
{%- if source_code_link %}
- **Source code**: {{ source_code_link }}
{%- endif %}

{%- if cmd.help_md %}

{{ cmd.help_md | escape_md }}
{%- endif %}

{%- set args = cmd.args | filter(attribute="hide", value=false) %}
{%- set flags = cmd.flags | filter(attribute="hide", value=false) %}
{%- set global_flags = flags | filter(attribute="global", value=true) %}
{%- set local_flags = flags | filter(attribute="global", value=false) %}
{#- if no subcommands, don't display flags as global #}
{%- if not cmd.subcommands %}
{%- set local_flags = flags %}
{%- set global_flags = [] %}
{%- endif %}

{%- if args %}

{{ "#" | repeat(count=header_level) }}# Arguments

{%- for arg in args %}

{{ "#" | repeat(count=header_level) }}## `{{ arg.usage }}`
{%- include "arg_template.md.tera" %}
{%- endfor %}
{%- endif %}

{%- if global_flags %}

{{ "#" | repeat(count=header_level) }}# Global Flags

{%- for flag in global_flags %}

{{ "#" | repeat(count=header_level) }}## `{{ flag.usage }}`
{%- include "flag_template.md.tera" %}
{%- endfor %}
{%- endif %}

{%- if local_flags %}

{{ "#" | repeat(count=header_level) }}# Flags

{%- for flag in local_flags %}

{{ "#" | repeat(count=header_level) }}## `{{ flag.usage }}`
{%- include "flag_template.md.tera" %}
{%- endfor %}
{%- endif %}

{%- if multi %}
{%- for name, cmd in cmd.subcommands %}
{%- if not cmd.hide or cmd.hide == false %}
{%- if loop.first %}

{{ "#" | repeat(count=header_level) }}# Subcommands
{% endif %}
- [`{{ spec.bin ~ " " ~ cmd.usage | trim }}`]({{ url_prefix }}/{{ cmd.full_cmd | join(sep="/") }}.md)
{%- endif -%}
{%- endfor -%}
{%- endif -%}

{%- if cmd.after_help_md %}

{{ cmd.after_help_md | escape_md }}
{%- endif -%}