Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
1e818f9c
Commit
1e818f9c
authored
Feb 12, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ansible-doc now shows return value docs
parent
8be8a7e2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
bin/ansible-doc
+6
-1
lib/ansible/utils/module_docs.py
+5
-1
No files found.
bin/ansible-doc
View file @
1e818f9c
...
...
@@ -141,7 +141,11 @@ def get_man_text(doc):
text
.
append
(
"
%
s
\n
"
%
(
ex
[
'code'
]))
if
'plainexamples'
in
doc
and
doc
[
'plainexamples'
]
is
not
None
:
text
.
append
(
"EXAMPLES:"
)
text
.
append
(
doc
[
'plainexamples'
])
if
'returndocs'
in
doc
and
doc
[
'returndocs'
]
is
not
None
:
text
.
append
(
"RETURN VALUES:"
)
text
.
append
(
doc
[
'returndocs'
])
text
.
append
(
''
)
return
"
\n
"
.
join
(
text
)
...
...
@@ -299,7 +303,7 @@ def main():
continue
try
:
doc
,
plainexamples
=
module_docs
.
get_docstring
(
filename
)
doc
,
plainexamples
,
returndocs
=
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
)
...
...
@@ -317,6 +321,7 @@ def main():
doc
[
'docuri'
]
=
doc
[
'module'
]
.
replace
(
'_'
,
'-'
)
doc
[
'now_date'
]
=
datetime
.
date
.
today
()
.
strftime
(
'
%
Y-
%
m-
%
d'
)
doc
[
'plainexamples'
]
=
plainexamples
doc
[
'returndocs'
]
=
returndocs
if
options
.
show_snippet
:
text
+=
get_snippet_text
(
doc
)
...
...
lib/ansible/utils/module_docs.py
View file @
1e818f9c
...
...
@@ -44,6 +44,7 @@ def get_docstring(filename, verbose=False):
doc
=
None
plainexamples
=
None
returndocs
=
None
try
:
# Thank you, Habbie, for this bit of code :-)
...
...
@@ -89,10 +90,13 @@ def get_docstring(filename, verbose=False):
if
'EXAMPLES'
in
(
t
.
id
for
t
in
child
.
targets
):
plainexamples
=
child
.
value
.
s
[
1
:]
# Skip first empty line
if
'RETURN'
in
(
t
.
id
for
t
in
child
.
targets
):
returndocs
=
child
.
value
.
s
[
1
:]
except
:
traceback
.
print_exc
()
# temp
if
verbose
==
True
:
traceback
.
print_exc
()
print
"unable to parse
%
s"
%
filename
return
doc
,
plainexamples
return
doc
,
plainexamples
,
returndocs
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment