Skip to content

Commit ab01bb2

Browse files
committed
Upgrade to prompt_toolkit >= 2
1 parent c8f666f commit ab01bb2

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ System Requirements
132132
Python Packages
133133
---------------
134134
* six >= 1.7.0
135-
* prettytable >= 0.7.0
136-
* click >= 5, < 7
137-
* requests >= 2.18.4
138-
* prompt_toolkit >= 0.53
135+
* ptable >= 0.9.2
136+
* click >= 7
137+
* requests >= 2.20.0
138+
* prompt_toolkit >= 2
139139
* pygments >= 2.0.0
140-
* urllib3 >= 1.22
140+
* urllib3 >= 1.24
141141

142142
Copyright
143143
---------

SoftLayer/shell/completer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,17 @@ def get_completions(self, document, complete_event):
2424
return _click_autocomplete(self.root, document.text_before_cursor)
2525

2626

27-
# pylint: disable=stop-iteration-return
2827
def _click_autocomplete(root, text):
2928
"""Completer generator for click applications."""
3029
try:
3130
parts = shlex.split(text)
3231
except ValueError:
33-
raise StopIteration
32+
return
3433

3534
location, incomplete = _click_resolve_command(root, parts)
3635

3736
if not text.endswith(' ') and not incomplete and text:
38-
raise StopIteration
37+
return
3938

4039
if incomplete and not incomplete[0:2].isalnum():
4140
for param in location.params:

SoftLayer/shell/core.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
import traceback
1414

1515
import click
16-
from prompt_toolkit import auto_suggest as p_auto_suggest
17-
from prompt_toolkit import shortcuts as p_shortcuts
16+
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
17+
from prompt_toolkit import PromptSession
1818

1919
from SoftLayer.CLI import core
2020
from SoftLayer.CLI import environment
@@ -48,12 +48,14 @@ def cli(ctx, env):
4848
os.makedirs(app_path)
4949
complete = completer.ShellCompleter(core.cli)
5050

51+
session = PromptSession()
52+
5153
while True:
5254
try:
53-
line = p_shortcuts.prompt(
55+
line = session.prompt(
5456
completer=complete,
5557
complete_while_typing=True,
56-
auto_suggest=p_auto_suggest.AutoSuggestFromHistory(),
58+
auto_suggest=AutoSuggestFromHistory(),
5759
)
5860

5961
# Parse arguments

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
'ptable >= 0.9.2',
3535
'click >= 7',
3636
'requests >= 2.20.0',
37-
'prompt_toolkit >= 0.53',
37+
'prompt_toolkit >= 2',
3838
'pygments >= 2.0.0',
3939
'urllib3 >= 1.24'
4040
],

tools/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ six >= 1.7.0
22
ptable >= 0.9.2
33
click >= 7
44
requests >= 2.20.0
5-
prompt_toolkit >= 0.53
5+
prompt_toolkit >= 2
66
pygments >= 2.0.0
77
urllib3 >= 1.24

tools/test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ six >= 1.7.0
88
ptable >= 0.9.2
99
click >= 7
1010
requests >= 2.20.0
11-
prompt_toolkit >= 0.53
11+
prompt_toolkit >= 2
1212
pygments >= 2.0.0
1313
urllib3 >= 1.24

0 commit comments

Comments
 (0)