diff options
author | Felix Fontein <felix@fontein.de> | 2023-03-24 01:37:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-23 17:37:09 -0700 |
commit | b3986131207266e682029f361e6c7daa87e1d7eb (patch) | |
tree | 3b84802622a5370584e9f963fa41cb0759f980ae /lib | |
parent | 054aa9215857f376ee4d387339e6b82bcc14b437 (diff) | |
download | ansible-b3986131207266e682029f361e6c7daa87e1d7eb.tar.gz |
Add support for plugin field in seealso. (#80212)
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/ansible/cli/doc.py | 14 |
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)) |