|
14 | 14 |
|
15 | 15 | import click |
16 | 16 | from prompt_toolkit import auto_suggest as p_auto_suggest |
17 | | -from prompt_toolkit import history as p_history |
18 | 17 | from prompt_toolkit import shortcuts as p_shortcuts |
19 | | -from pygments import token |
20 | 18 |
|
21 | 19 | from SoftLayer.CLI import core |
22 | 20 | from SoftLayer.CLI import environment |
@@ -49,33 +47,14 @@ def cli(ctx, env): |
49 | 47 | app_path = click.get_app_dir('softlayer_shell') |
50 | 48 | if not os.path.exists(app_path): |
51 | 49 | os.makedirs(app_path) |
52 | | - history = p_history.FileHistory(os.path.join(app_path, 'history')) |
53 | 50 | complete = completer.ShellCompleter(core.cli) |
54 | 51 |
|
55 | 52 | while True: |
56 | | - def get_prompt_tokens(_): |
57 | | - """Returns tokens for the command prompt""" |
58 | | - tokens = [] |
59 | | - try: |
60 | | - tokens.append((token.Token.Username, env.client.auth.username)) |
61 | | - tokens.append((token.Token.At, "@")) |
62 | | - except AttributeError: |
63 | | - pass |
64 | | - |
65 | | - tokens.append((token.Token.Host, "slcli-shell")) |
66 | | - if env.vars['last_exit_code']: |
67 | | - tokens.append((token.Token.ErrorPrompt, '> ')) |
68 | | - else: |
69 | | - tokens.append((token.Token.Prompt, '> ')) |
70 | | - |
71 | | - return tokens |
72 | | - |
73 | 53 | try: |
74 | 54 | line = p_shortcuts.prompt( |
75 | 55 | completer=complete, |
76 | | - history=history, |
| 56 | + complete_while_typing=True, |
77 | 57 | auto_suggest=p_auto_suggest.AutoSuggestFromHistory(), |
78 | | - get_prompt_tokens=get_prompt_tokens, |
79 | 58 | ) |
80 | 59 |
|
81 | 60 | # Parse arguments |
|
0 commit comments