mirror of
https://github.com/koloideal/Argenta.git
synced 2026-08-08 17:01:13 +03:00
Merge branch 'main' into benchmarks
This commit is contained in:
@@ -6,6 +6,7 @@ from contextlib import redirect_stdout
|
||||
from typing import Callable, Never, TypeAlias
|
||||
|
||||
from art import text2art
|
||||
from prompt_toolkit import HTML
|
||||
from rich.console import Console
|
||||
from rich.markup import escape
|
||||
|
||||
@@ -37,7 +38,7 @@ class BaseApp:
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
prompt: str,
|
||||
prompt: str | HTML,
|
||||
initial_message: str,
|
||||
farewell_message: str,
|
||||
exit_command: Command,
|
||||
@@ -48,7 +49,7 @@ class BaseApp:
|
||||
autocompleter: AutoCompleter,
|
||||
print_func: Printer,
|
||||
) -> None:
|
||||
self._prompt: str = prompt
|
||||
self._prompt: str | HTML = prompt
|
||||
self._print_func: Printer = print_func
|
||||
self._exit_command: Command = exit_command
|
||||
self._dividing_line: StaticDividingLine | DynamicDividingLine = dividing_line
|
||||
@@ -307,7 +308,7 @@ class BaseApp:
|
||||
Private. Sets up default app view
|
||||
:return: None
|
||||
"""
|
||||
self._prompt = f"[italic dim bold]{self._prompt}[/italic dim bold]"
|
||||
self._prompt = f"<gray><b>{self._prompt}</b></gray>"
|
||||
self._initial_message = (
|
||||
"\n" + f"[bold red]{text2art(self._initial_message, font='tarty1')}" + "\n"
|
||||
)
|
||||
@@ -404,7 +405,7 @@ class App(BaseApp):
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
prompt: str = "What do you want to do?\n\n",
|
||||
prompt: str | HTML = ">>> ",
|
||||
initial_message: str = "Argenta\n",
|
||||
farewell_message: str = "\nSee you\n",
|
||||
exit_command: Command = DEFAULT_EXIT_COMMAND,
|
||||
@@ -455,7 +456,7 @@ class App(BaseApp):
|
||||
if self._repeat_command_groups_printing:
|
||||
self._print_command_group_description()
|
||||
|
||||
raw_command: str = Console().input(self._prompt)
|
||||
raw_command: str = self._autocompleter.prompt(self._prompt)
|
||||
|
||||
try:
|
||||
input_command: InputCommand = InputCommand.parse(raw_command=raw_command)
|
||||
@@ -468,7 +469,6 @@ class App(BaseApp):
|
||||
|
||||
if self._is_exit_command(input_command):
|
||||
self.system_router.finds_appropriate_handler(input_command)
|
||||
self._autocompleter.exit_setup(self.registered_routers.get_triggers())
|
||||
return
|
||||
|
||||
if self._is_unknown_command(input_command):
|
||||
|
||||
Reference in New Issue
Block a user