summaryrefslogtreecommitdiff
path: root/cmd2/argcomplete_bridge.py
diff options
context:
space:
mode:
authorEric Lin <anselor@gmail.com>2018-05-02 14:13:12 -0400
committerEric Lin <anselor@gmail.com>2018-05-02 14:13:12 -0400
commit148f05d0af66f38c8ba6ca3a5619f50a8bb1b8a9 (patch)
tree10513021d2932b205375e444c2f51a104cebbbc1 /cmd2/argcomplete_bridge.py
parent8d8db3f31b40c39cae43ec3d2bda0ea0c258b3db (diff)
downloadcmd2-git-148f05d0af66f38c8ba6ca3a5619f50a8bb1b8a9.tar.gz
Addressed comments.
Diffstat (limited to 'cmd2/argcomplete_bridge.py')
-rw-r--r--cmd2/argcomplete_bridge.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/cmd2/argcomplete_bridge.py b/cmd2/argcomplete_bridge.py
index 5383ebec..583f3345 100644
--- a/cmd2/argcomplete_bridge.py
+++ b/cmd2/argcomplete_bridge.py
@@ -148,16 +148,15 @@ else:
# not an argument completion invocation
return
- global debug_stream
try:
- debug_stream = os.fdopen(9, "w")
- except:
- debug_stream = sys.stderr
+ argcomplete.debug_stream = os.fdopen(9, "w")
+ except IOError:
+ argcomplete.debug_stream = sys.stderr
if output_stream is None:
try:
output_stream = os.fdopen(8, "wb")
- except:
+ except IOError:
argcomplete.debug("Unable to open fd 8 for writing, quitting")
exit_method(1)
@@ -234,7 +233,7 @@ else:
# to ever match.
outstr = outstr.replace('\n', ' ').replace('\t', ' ').replace(' ', ' ').strip()
# generate a filler entry that should always sort first
- filler = ' {0:><{width}}'.format('', width=len(outstr))
+ filler = ' {0:><{width}}'.format('', width=len(outstr)/2)
outstr = ifs.join([filler, outstr])
output_stream.write(outstr.encode(argcomplete.sys_encoding))
@@ -243,6 +242,5 @@ else:
# go forward with normal filesystem completion
output_stream.write(ifs.join([]).encode(argcomplete.sys_encoding))
output_stream.flush()
- debug_stream.flush()
+ argcomplete.debug_stream.flush()
exit_method(0)
-