{#- The page for one command in content/cli/, replacing usage's built-in
"command" template (mise run render passes it with --template). It adds
Hugo front matter: the page title, a description from the command's
short help, and a weight that groups the commands by role in the CLI
sidebar. The rest follows usage's compact command template, with
sentence-case headings and examples marked as shell unless an example
names its language.
usage writes its "@generated" banner above this output; the render task
moves the banner below the front matter, which Hugo requires first. -#}
{%- set weights = {
"create": 10, "keygen": 11, "releases": 12,
"verify": 20, "pin": 21, "show": 22,
"install": 30,
"schema": 40, "completion": 41, "version": 42
} %}
{%- set source_code_link = source_code_link(spec=spec, cmd=cmd) %}
{%- set full_cmd = cmd.full_cmd | join(sep=" ") %}
{%- if multi -%}
---
title: '{{ (spec.bin ~ " " ~ full_cmd) | trim }}'
description: '{{ cmd.help | default(value="") | replace(from="'", to="''") }}.'
weight: {{ weights[cmd.name] | default(value=90) }}
---
{{ "#" | 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.deprecated or cmd.deprecated_warn_at or cmd.deprecated_remove_at %}
- **Deprecated:**{% if cmd.deprecated %} {{ cmd.deprecated }}{% if cmd.deprecated_warn_at or cmd.deprecated_remove_at %};{% endif %}{% endif %}{% if cmd.deprecated_warn_at %} Warns at {{ cmd.deprecated_warn_at }}.{% endif %}{% if cmd.deprecated_remove_at %} Removed at {{ cmd.deprecated_remove_at }}.{% endif %}
{%- endif %}
{%- if cmd.aliases %}
- **Aliases:** `{{ cmd.aliases | join(sep="`, `") }}`
{%- endif %}
{%- if cmd.effect %}
- **Effect:** {% if cmd.effect == "read" %}read-only{% elif cmd.effect == "destructive" %}destructive — may delete or irreversibly overwrite{% else %}modifies state{% endif %}
{%- endif %}
{%- if source_code_link %}
- **Source code:** {{ source_code_link }}
{%- endif %}
{%- if cmd.help_md %}
{{ cmd.help_md | escape_md }}
{%- endif %}
{%- for arg_group in cmd.arg_groups %}
{%- set visible = arg_group.items | filter(attribute="hide", value=false) %}
{%- if visible %}
{{ "#" | repeat(count=header_level) }}# {{ arg_group.heading | default(value="Arguments") }}
{%- if arg_group.help %}
{{ arg_group.help }}
{%- endif %}
{% for arg in visible %}
{%- include "arg_template.md.tera" -%}
{%- if not loop.last %}{{ "\n" }}{% endif %}
{%- endfor %}
{%- endif %}
{%- endfor %}
{%- for flag_group in cmd.flag_groups %}
{%- set visible = flag_group.items | filter(attribute="hide", value=false) %}
{%- set group_globals = visible | filter(attribute="global", value=true) %}
{%- if cmd.subcommands and group_globals %}
{{ "#" | repeat(count=header_level) }}# {{ flag_group.heading | default(value="Global flags") }}
{% for flag in group_globals %}
{%- include "flag_template.md.tera" -%}
{%- if not loop.last %}{{ "\n" }}{% endif %}
{%- endfor %}
{%- endif %}
{%- endfor %}
{%- for flag_group in cmd.flag_groups %}
{%- set visible = flag_group.items | filter(attribute="hide", value=false) %}
{%- set group_flags = visible | filter(attribute="global", value=false) %}
{%- if not cmd.subcommands %}
{%- set group_flags = visible %}
{%- endif %}
{%- if group_flags %}
{{ "#" | repeat(count=header_level) }}# {{ flag_group.heading | default(value="Flags") }}
{%- if flag_group.help %}
{{ flag_group.help }}
{%- endif %}
{% for flag in group_flags %}
{%- include "flag_template.md.tera" -%}
{%- if not loop.last %}{{ "\n" }}{% endif %}
{%- endfor %}
{%- endif %}
{%- endfor %}
{%- if cmd.outputs %}
{{ "#" | repeat(count=header_level) }}# Output formats
{%- set collapse_outputs = cmd.outputs | length > 5 %}
{%- if collapse_outputs %}
<details>
<summary>{{ cmd.outputs | length }} available formats</summary>
{%- endif %}
{% for output in cmd.outputs %}
- **`{{ output.name }}`**{% if output.default %} (default){% endif %}{% if output.help %} — {{ output.help }}{% endif %}
**Framing:** `{{ output.framing }}`{% if output.streaming %} — one document per line, read as it arrives{% endif %}{% if output.select %}; **Select:** `{{ output.select }}`{% endif %}
{%- if output.media_type %}
**Media type:** `{{ output.media_type }}`
{%- endif %}
{%- if output.schema %}
<details><summary>Schema</summary>
```json
{{ output.schema | replace(from="\n", to="\n ") }}
```
</details>
{%- endif %}
{%- endfor %}
{%- if collapse_outputs %}
</details>
{%- endif %}
{%- endif %}
{%- if cmd.exit_codes %}
{{ "#" | repeat(count=header_level) }}# Exit status
| Code | Meaning |
| ---- | ------- |
{%- for exit_code in cmd.exit_codes %}
| `{{ exit_code.code }}` | {{ exit_code.help | replace(from="|", to="\\|") }} |
{%- endfor %}
{%- endif %}
{%- if cmd.examples %}
{{ "#" | repeat(count=header_level) }}# Examples
{%- for example in cmd.examples %}
{%- if example.header %}
**{{ example.header }}**
{%- endif %}
{%- if example.help %}
{{ example.help }}
{%- endif %}
```{% if example.lang %}{{ example.lang }}{% else %}sh{% endif %}
{{ example.code }}
```
{%- endfor %}
{%- endif %}
{%- if multi %}
{%- for cmd in cmd.subcommands | values | filter(attribute="hide", value=false) | sort(attribute="usage") %}
{%- 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="/") }}{{ link_extension }})
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- if cmd.after_help_md %}
{{ cmd.after_help_md | escape_md }}
{%- endif -%}