Skip to content

Commit 148f05d

Browse files
committed
Addressed comments.
1 parent 8d8db3f commit 148f05d

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

cmd2/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
#
22
# -*- coding: utf-8 -*-
3-
4-

cmd2/argcomplete_bridge.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,15 @@ def __call__(self, argument_parser, completer=None, always_complete_options=True
148148
# not an argument completion invocation
149149
return
150150

151-
global debug_stream
152151
try:
153-
debug_stream = os.fdopen(9, "w")
154-
except:
155-
debug_stream = sys.stderr
152+
argcomplete.debug_stream = os.fdopen(9, "w")
153+
except IOError:
154+
argcomplete.debug_stream = sys.stderr
156155

157156
if output_stream is None:
158157
try:
159158
output_stream = os.fdopen(8, "wb")
160-
except:
159+
except IOError:
161160
argcomplete.debug("Unable to open fd 8 for writing, quitting")
162161
exit_method(1)
163162

@@ -234,7 +233,7 @@ def __call__(self, argument_parser, completer=None, always_complete_options=True
234233
# to ever match.
235234
outstr = outstr.replace('\n', ' ').replace('\t', ' ').replace(' ', ' ').strip()
236235
# generate a filler entry that should always sort first
237-
filler = ' {0:><{width}}'.format('', width=len(outstr))
236+
filler = ' {0:><{width}}'.format('', width=len(outstr)/2)
238237
outstr = ifs.join([filler, outstr])
239238

240239
output_stream.write(outstr.encode(argcomplete.sys_encoding))
@@ -243,6 +242,5 @@ def __call__(self, argument_parser, completer=None, always_complete_options=True
243242
# go forward with normal filesystem completion
244243
output_stream.write(ifs.join([]).encode(argcomplete.sys_encoding))
245244
output_stream.flush()
246-
debug_stream.flush()
245+
argcomplete.debug_stream.flush()
247246
exit_method(0)
248-

examples/alias_startup.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44
1) How to add custom command aliases using the alias command
55
2) How to load an initialization script at startup
66
"""
7-
import argparse
87

98
from cmd2 import cmd2
10-
import pyparsing
11-
12-
from cmd2.cmd2 import with_argument_list, with_argparser, with_argparser_and_unknown_args
139

1410

1511
class AliasAndStartup(cmd2.Cmd):

examples/help_categories.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
A sample application for tagging categories on commands.
55
"""
66

7-
from cmd2.cmd2 import Cmd, categorize, __version__, with_argparser, with_category
87
import argparse
98

9+
from cmd2.cmd2 import Cmd, categorize, __version__, with_argparser, with_category
10+
1011

1112
class HelpCategories(Cmd):
1213
""" Example cmd2 application. """

0 commit comments

Comments
 (0)