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:
parent
6a883f1cd6
commit
26827f5039
3 changed files with 12 additions and 0 deletions
2
changelogs/fragments/doc_knows_cli.yml
Normal file
2
changelogs/fragments/doc_knows_cli.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- ansible-doc pretty cli options output.
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -232,6 +232,7 @@ DOCUMENTATION = '''
|
|||
- name: ansible_ssh_private_key_file
|
||||
cli:
|
||||
- name: private_key_file
|
||||
option: '--private-key'
|
||||
|
||||
control_path:
|
||||
description:
|
||||
|
|
Loading…
Reference in a new issue