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
92e2f542
Commit
92e2f542
authored
Aug 14, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed issues with utf-8 encoding in docs, moved pager to use display class instad of bare prints
parent
3b75f3d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
lib/ansible/cli/__init__.py
+7
-8
lib/ansible/cli/doc.py
+2
-2
No files found.
lib/ansible/cli/__init__.py
View file @
92e2f542
...
...
@@ -432,21 +432,20 @@ class CLI(object):
return
result
@staticmethod
def
pager
(
text
):
def
pager
(
self
,
text
):
''' find reasonable way to display text '''
# this is a much simpler form of what is in pydoc.py
if
not
sys
.
stdout
.
isatty
():
print
(
text
)
self
.
display
.
display
(
text
)
elif
'PAGER'
in
os
.
environ
:
if
sys
.
platform
==
'win32'
:
print
(
text
)
self
.
display
.
display
(
text
)
else
:
CLI
.
pager_pipe
(
text
,
os
.
environ
[
'PAGER'
])
self
.
pager_pipe
(
text
,
os
.
environ
[
'PAGER'
])
elif
subprocess
.
call
(
'(less --version) 2> /dev/null'
,
shell
=
True
)
==
0
:
CLI
.
pager_pipe
(
text
,
'less'
)
self
.
pager_pipe
(
text
,
'less'
)
else
:
print
(
text
)
self
.
display
.
display
(
text
)
@staticmethod
def
pager_pipe
(
text
,
cmd
):
...
...
@@ -455,7 +454,7 @@ class CLI(object):
os
.
environ
[
'LESS'
]
=
CLI
.
LESS_OPTS
try
:
cmd
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
stdin
=
subprocess
.
PIPE
,
stdout
=
sys
.
stdout
)
cmd
.
communicate
(
input
=
text
)
cmd
.
communicate
(
input
=
text
.
encode
(
sys
.
stdout
.
encoding
)
)
except
IOError
:
pass
except
KeyboardInterrupt
:
...
...
lib/ansible/cli/doc.py
View file @
92e2f542
...
...
@@ -73,7 +73,7 @@ class DocCLI(CLI):
for
path
in
paths
:
self
.
find_modules
(
path
)
CLI
.
pager
(
self
.
get_module_list_text
())
self
.
pager
(
self
.
get_module_list_text
())
return
0
if
len
(
self
.
args
)
==
0
:
...
...
@@ -125,7 +125,7 @@ class DocCLI(CLI):
self
.
display
.
vvv
(
traceback
.
print_exc
())
raise
AnsibleError
(
"module
%
s missing documentation (or could not parse documentation):
%
s
\n
"
%
(
module
,
str
(
e
)))
CLI
.
pager
(
text
)
self
.
pager
(
text
)
return
0
def
find_modules
(
self
,
path
):
...
...
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