Skip to content

Commit 6470d56

Browse files
committed
Grouped readline code together
1 parent cc45557 commit 6470d56

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

cmd2/cmd2.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
from . import constants
5353
from . import utils
5454

55+
from cmd2.parsing import StatementParser, Statement
56+
5557
# Set up readline
5658
from .rl_utils import rl_type, RlType
5759
if rl_type == RlType.NONE:
@@ -60,25 +62,22 @@
6062
sys.stderr.write(Fore.LIGHTYELLOW_EX + rl_err_msg + Fore.RESET)
6163
else:
6264
from .rl_utils import rl_force_redisplay, readline
65+
from .argparse_completer import AutoCompleter, ACArgumentParser
6366

64-
from .argparse_completer import AutoCompleter, ACArgumentParser
65-
66-
from cmd2.parsing import StatementParser, Statement
67-
68-
if rl_type == RlType.PYREADLINE:
67+
if rl_type == RlType.PYREADLINE:
6968

70-
# Save the original pyreadline display completion function since we need to override it and restore it
71-
# noinspection PyProtectedMember
72-
orig_pyreadline_display = readline.rl.mode._display_completions
69+
# Save the original pyreadline display completion function since we need to override it and restore it
70+
# noinspection PyProtectedMember
71+
orig_pyreadline_display = readline.rl.mode._display_completions
7372

74-
elif rl_type == RlType.GNU:
73+
elif rl_type == RlType.GNU:
7574

76-
# We need wcswidth to calculate display width of tab completions
77-
from wcwidth import wcswidth
75+
# We need wcswidth to calculate display width of tab completions
76+
from wcwidth import wcswidth
7877

79-
# Get the readline lib so we can make changes to it
80-
import ctypes
81-
from .rl_utils import readline_lib
78+
# Get the readline lib so we can make changes to it
79+
import ctypes
80+
from .rl_utils import readline_lib
8281

8382
# Newer versions of pyperclip are released as a single file, but older versions had a more complicated structure
8483
try:

0 commit comments

Comments
 (0)