summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFelix Fontein <felix@fontein.de>2023-03-24 01:37:09 +0100
committerGitHub <noreply@github.com>2023-03-23 17:37:09 -0700
commitb3986131207266e682029f361e6c7daa87e1d7eb (patch)
tree3b84802622a5370584e9f963fa41cb0759f980ae /lib
parent054aa9215857f376ee4d387339e6b82bcc14b437 (diff)
downloadansible-b3986131207266e682029f361e6c7daa87e1d7eb.tar.gz
Add support for plugin field in seealso. (#80212)
Diffstat (limited to 'lib')
-rwxr-xr-xlib/ansible/cli/doc.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py
index 54b328074f..97e6766336 100755
--- a/lib/ansible/cli/doc.py
+++ b/lib/ansible/cli/doc.py
@@ -1296,6 +1296,20 @@ class DocCLI(CLI, RoleMixin):
relative_url = 'collections/%s_module.html' % item['module'].replace('.', '/', 2)
text.append(textwrap.fill(DocCLI.tty_ify(get_versioned_doclink(relative_url)),
limit - 6, initial_indent=opt_indent + ' ', subsequent_indent=opt_indent))
+ elif 'plugin' in item and 'plugin_type' in item:
+ plugin_suffix = ' plugin' if item['plugin_type'] not in ('module', 'role') else ''
+ text.append(textwrap.fill(DocCLI.tty_ify('%s%s %s' % (item['plugin_type'].title(), plugin_suffix, item['plugin'])),
+ limit - 6, initial_indent=opt_indent[:-2] + "* ", subsequent_indent=opt_indent))
+ description = item.get('description')
+ if description is None and item['plugin'].startswith('ansible.builtin.'):
+ description = 'The official documentation on the %s %s%s.' % (item['plugin'], item['plugin_type'], plugin_suffix)
+ if description is not None:
+ text.append(textwrap.fill(DocCLI.tty_ify(description),
+ limit - 6, initial_indent=opt_indent + ' ', subsequent_indent=opt_indent + ' '))
+ if item['plugin'].startswith('ansible.builtin.'):
+ relative_url = 'collections/%s_%s.html' % (item['plugin'].replace('.', '/', 2), item['plugin_type'])
+ text.append(textwrap.fill(DocCLI.tty_ify(get_versioned_doclink(relative_url)),
+ limit - 6, initial_indent=opt_indent + ' ', subsequent_indent=opt_indent))
elif 'name' in item and 'link' in item and 'description' in item:
text.append(textwrap.fill(DocCLI.tty_ify(item['name']),
limit - 6, initial_indent=opt_indent[:-2] + "* ", subsequent_indent=opt_indent))