diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-05-08 09:42:37 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-05-08 09:42:37 -0400 |
commit | 6470d56fca8b585a1eaec72cee1e9ca8dc1f96ea (patch) | |
tree | b9850a7913540d6a58c0d38a2f6d167817f80254 /cmd2/cmd2.py | |
parent | cc455576abf40dab1fe80be0099a97c7c8207e16 (diff) | |
download | cmd2-git-6470d56fca8b585a1eaec72cee1e9ca8dc1f96ea.tar.gz |
Grouped readline code together
Diffstat (limited to 'cmd2/cmd2.py')
-rwxr-xr-x | cmd2/cmd2.py | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index ee6beb98..8c234dab 100755 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -52,6 +52,8 @@ import pyperclip from . import constants from . import utils +from cmd2.parsing import StatementParser, Statement + # Set up readline from .rl_utils import rl_type, RlType if rl_type == RlType.NONE: @@ -60,25 +62,22 @@ if rl_type == RlType.NONE: sys.stderr.write(Fore.LIGHTYELLOW_EX + rl_err_msg + Fore.RESET) else: from .rl_utils import rl_force_redisplay, readline + from .argparse_completer import AutoCompleter, ACArgumentParser -from .argparse_completer import AutoCompleter, ACArgumentParser - -from cmd2.parsing import StatementParser, Statement - -if rl_type == RlType.PYREADLINE: + if rl_type == RlType.PYREADLINE: - # Save the original pyreadline display completion function since we need to override it and restore it - # noinspection PyProtectedMember - orig_pyreadline_display = readline.rl.mode._display_completions + # Save the original pyreadline display completion function since we need to override it and restore it + # noinspection PyProtectedMember + orig_pyreadline_display = readline.rl.mode._display_completions -elif rl_type == RlType.GNU: + elif rl_type == RlType.GNU: - # We need wcswidth to calculate display width of tab completions - from wcwidth import wcswidth + # We need wcswidth to calculate display width of tab completions + from wcwidth import wcswidth - # Get the readline lib so we can make changes to it - import ctypes - from .rl_utils import readline_lib + # Get the readline lib so we can make changes to it + import ctypes + from .rl_utils import readline_lib # Newer versions of pyperclip are released as a single file, but older versions had a more complicated structure try: |