ansible-doc don't show empty paths (#85294)

If no path is given, it can only mean that it is a Jinja plugin, display Jinja as 'provider' then.

(cherry picked from commit 8ec403a3b9)
pull/85383/head
Brian Coca 6 months ago committed by Matt Clay
parent 3ad711aee4
commit 05b3eafeae

@ -1440,7 +1440,7 @@ class DocCLI(CLI, RoleMixin):
pad = display.columns * 0.20
limit = max(display.columns - int(pad), 70)
text.append("> %s %s (%s)" % (plugin_type.upper(), _format(doc.pop('plugin_name'), 'bold'), doc.pop('filename')))
text.append("> %s %s (%s)" % (plugin_type.upper(), _format(doc.pop('plugin_name'), 'bold'), doc.pop('filename') or 'Jinja2'))
if isinstance(doc['description'], list):
descs = doc.pop('description')

@ -287,3 +287,6 @@ echo "test 'sidecar' for no extension module with .py doc"
echo "test 'sidecar' for no extension module with .yml doc"
[ "$(ansible-doc -M ./library -l ansible.legacy |grep -v 'UNDOCUMENTED' |grep -c facts_one)" == "1" ]
echo "Test j2 plugins get jinja2 instead of path"
ansible-doc -t filter map 2>&1 |grep "${GREP_OPTS[@]}" '(Jinja2)'

Loading…
Cancel
Save