1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
{# Template takes in a list of CommandSummary objects #}
{% macro render_param(param) -%}
{% if param.is_argument -%}
**`{{ param.human_readable_name }}`**
{% else %}
{% if param.opts | length > 0 -%}
{% for param in param.opts %} **`{{ param }}`**{% if not loop.last %}, {% endif %}{% endfor -%}
{% endif -%}
{% if param.secondary_opts | length > 0 -%}
/{% for param in param.secondary_opts -%} **`{{ param }}`**{% if not loop.last %}, {% endif %}{% endfor -%}
{% endif -%}
{%- if not param.type | lower == "boolean" %}
`{{ param.metavar }}`
{% endif -%}
{% endif %}<br />
{%- if param.help -%}
{{ param.help_md }}
{%- endif -%}
{%- if param.multiple -%}
<br />*Separate multiple values with commas
{%- if param.opts%}, or use `{{ param.opts | first }}` multiple times{% endif %}.*
{%- endif -%}<br />
{#- bandaid to patch in harborapi query usage -#}
{%- if not param.is_argument and param.name == "query" -%}
See [harborapi docs](https://unioslo.github.io/harborapi/usage/methods/read/#query) for more information.<br />
{%- endif -%}
**Type:** `{{ param.type}}` {% if param.is_flag %}(flag){% endif %}<br />
{%- if param.type == "choice" -%}
**Choices:** {% for element in param.choices -%}{{ "`" + element + "`" if loop.first else ", `" + element + "`" }}{% endfor %}<br />
{%- endif -%}
{%- if param.min is not none -%}
**Min:** `{{ param.min }}`<br />
{%- endif -%}
{%- if param.max is not none -%}
**Max:** `{{ param.max }}`<br />
{%- endif -%}
{%- if param.default is not none -%}
**Default:** `{{ param.default }}`<br />
{%- endif -%}
{%- if param.required -%}
**Required:** ✅<br />
{%- endif -%}
{%- endmacro %}
{% if category | length > 0 %}
# {{ category }}
{% else %}
# Top-level commands
{% endif %}
{% for command in commands %}
## {{ command.name }}
{% if command.deprecated -%}
!!! warning "Deprecated"
This command is deprecated and will be unsupported in the future.
{% endif -%}
```
{{ command.usage }}
```
{{ command.help_md }}
{# Only show this section if we have arguments #}
{% if command.arguments | length > 0 %}
**Arguments**
{% for param in command.arguments %}
{{ render_param(param) }}
{# End param loop #}
{% endfor %}
{# End argument listing #}
{% endif %}
{# Only show this section if we have options #}
{% if command.options | length > 0 %}
**Options**
{# Opts. Example (--wizard/--no-wizard) #}
{% for param in command.options %}
{{ render_param(param) }}
{# End param loop #}
{% endfor %}
{# End params listing #}
{% endif %}
----
{# End category commands loop #}
{% endfor %}
|