mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Adapt prompt_toolkit call because now using the v3.x of the lib
This commit is contained in:
parent
824a9ed42e
commit
d901d28add
1 changed files with 14 additions and 13 deletions
|
@ -550,35 +550,36 @@ class Interface:
|
||||||
if not is_multiline:
|
if not is_multiline:
|
||||||
|
|
||||||
import prompt_toolkit
|
import prompt_toolkit
|
||||||
from prompt_toolkit.contrib.completers import WordCompleter
|
from prompt_toolkit.completion import WordCompleter
|
||||||
|
from prompt_toolkit.styles import Style
|
||||||
from pygments.token import Token
|
from pygments.token import Token
|
||||||
|
|
||||||
autocomplete_ = WordCompleter(autocomplete)
|
autocomplete_ = WordCompleter(autocomplete)
|
||||||
style = prompt_toolkit.styles.style_from_dict(
|
style = Style.from_dict(
|
||||||
{
|
{
|
||||||
Token.Message: f"#ansi{color} bold",
|
"": "",
|
||||||
|
"message": f"#ansi{color} bold",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_bottom_toolbar_tokens(cli):
|
def bottom_toolbar():
|
||||||
if help:
|
if help:
|
||||||
return [(Token, help)]
|
return [("class:", help)]
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_tokens(cli):
|
colored_message = [
|
||||||
return [
|
("class:message", message),
|
||||||
(Token.Message, message),
|
("class:", ": "),
|
||||||
(Token, ": "),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
return prompt_toolkit.prompt(
|
return prompt_toolkit.prompt(
|
||||||
get_prompt_tokens=get_tokens,
|
colored_message,
|
||||||
get_bottom_toolbar_tokens=get_bottom_toolbar_tokens,
|
bottom_toolbar=bottom_toolbar,
|
||||||
style=style,
|
style=style,
|
||||||
default=prefill,
|
default=prefill,
|
||||||
true_color=True,
|
|
||||||
completer=autocomplete_,
|
completer=autocomplete_,
|
||||||
|
complete_while_typing=True,
|
||||||
is_password=is_password,
|
is_password=is_password,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue