ansible-doc fix displaying 'CLI' options for plugin docs

cli options will now display either use provided info, or automating from the name


Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
This commit is contained in:
Brian Coca 2021-06-04 10:22:39 -04:00 committed by GitHub
parent 6a883f1cd6
commit 26827f5039
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- ansible-doc pretty cli options output.

View file

@ -1043,6 +1043,15 @@ class DocCLI(CLI, RoleMixin):
if ignore in item:
del item[ignore]
if 'cli' in opt and opt['cli']:
conf['cli'] = []
for cli in opt['cli']:
if 'option' not in cli:
conf['cli'].append({'name': cli['name'], 'option': '--%s' % cli['name'].replace('_', '-')})
else:
conf['cli'].append(cli)
del opt['cli']
if conf:
text.append(DocCLI._dump_yaml({'set_via': conf}, opt_indent))

View file

@ -232,6 +232,7 @@ DOCUMENTATION = '''
- name: ansible_ssh_private_key_file
cli:
- name: private_key_file
option: '--private-key'
control_path:
description: