mirror of
https://github.com/zebrajr/ansible.git
synced 2025-12-06 00:19:48 +01:00
Include subcommands in generated man pages (#81378)
Sub commands of `ansible-galaxy role` and `ansible-galaxy collection` are now documented.
This commit is contained in:
parent
32b388b4ca
commit
081c60b9d3
2
changelogs/fragments/man-page-subcommands.yml
Normal file
2
changelogs/fragments/man-page-subcommands.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- man page build - Sub commands of ``ansible-galaxy role`` and ``ansible-galaxy collection`` are now documented.
|
||||
|
|
@ -1,3 +1,24 @@
|
|||
{% macro render_action(parent, action, action_docs) -%}
|
||||
**{{ parent + action }}**
|
||||
{{ (action_docs['desc']|default(' ')) |replace('\n', ' ')}}
|
||||
|
||||
{% if action_docs['options'] %}
|
||||
{% for option in action_docs['options']|sort(attribute='options') %}
|
||||
{% for switch in option['options'] if switch in action_docs['option_names'] %} **{{switch}}**{% if option['arg'] %} '{{option['arg']}}'{% endif %}{% if not loop.last %}, {% endif %}{% endfor %}
|
||||
|
||||
{{ (option['desc']) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% set nested_actions = action_docs['actions'] %}
|
||||
{% if nested_actions %}
|
||||
{% for nested_action in nested_actions %}
|
||||
{{ render_action(parent + action + ' ', nested_action, nested_actions[nested_action]) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{%- endmacro %}
|
||||
|
||||
{{ cli_name }}
|
||||
{{ '=' * ( cli_name|length|int ) }}
|
||||
|
||||
|
|
@ -46,16 +67,7 @@ ARGUMENTS
|
|||
ACTIONS
|
||||
-------
|
||||
{% for action in actions %}
|
||||
**{{ action }}**
|
||||
{{ (actions[action]['desc']|default(' ')) |replace('\n', ' ')}}
|
||||
|
||||
{% if actions[action]['options'] %}
|
||||
{% for option in actions[action]['options']|sort(attribute='options') %}
|
||||
{% for switch in option['options'] if switch in actions[action]['option_names'] %} **{{switch}}**{% if option['arg'] %} '{{option['arg']}}'{% endif %}{% if not loop.last %}, {% endif %}{% endfor %}
|
||||
|
||||
{{ (option['desc']) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{{ render_action('', action, actions[action]) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user