mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Add support for additional EXAMPLES string in Ansible modules
return DOC and EXAMPLES as a list add moduledev explanation more
This commit is contained in:
@@ -91,6 +91,9 @@ def print_man(doc):
|
||||
for ex in doc['examples']:
|
||||
print "%s\n" % (ex['code'])
|
||||
|
||||
if 'plainexamples' in doc and doc['plainexamples'] is not None:
|
||||
print doc['plainexamples']
|
||||
|
||||
def print_snippet(doc):
|
||||
|
||||
desc = tty_ify("".join(doc['short_description']))
|
||||
@@ -153,7 +156,7 @@ def main():
|
||||
|
||||
filename = utils.plugins.module_finder.find_plugin(module)
|
||||
try:
|
||||
doc = module_docs.get_docstring(filename)
|
||||
doc, plainexamples = module_docs.get_docstring(filename)
|
||||
desc = tty_ify(doc.get('short_description', '?'))
|
||||
if len(desc) > 55:
|
||||
desc = desc + '...'
|
||||
@@ -180,7 +183,7 @@ def main():
|
||||
continue
|
||||
|
||||
try:
|
||||
doc = module_docs.get_docstring(filename)
|
||||
doc, plainexamples = module_docs.get_docstring(filename)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
sys.stderr.write("ERROR: module %s has a documentation error formatting or is missing documentation\n" % module)
|
||||
@@ -197,6 +200,7 @@ def main():
|
||||
doc['filename'] = filename
|
||||
doc['docuri'] = doc['module'].replace('_', '-')
|
||||
doc['now_date'] = datetime.date.today().strftime('%Y-%m-%d')
|
||||
doc['plainexamples'] = plainexamples
|
||||
|
||||
if options.show_snippet:
|
||||
print_snippet(doc)
|
||||
|
||||
Reference in New Issue
Block a user