This commit is contained in:
2025-04-13 13:13:03 +03:00
parent 8506e4ffcf
commit a6db733204
3 changed files with 19 additions and 19 deletions
+11 -13
View File
@@ -105,6 +105,15 @@ class AppPrinters(AppInit):
self._print_func(self._dividing_line.get_full_line(max_length_line))
def _print_framed_text(self, text: str):
if isinstance(self._dividing_line, StaticDividingLine):
self._print_func(self._dividing_line.get_full_line())
self._print_func(text)
self._print_func(self._dividing_line.get_full_line())
elif isinstance(self._dividing_line, DynamicDividingLine):
self._print_framed_text_with_dynamic_line(text)
class AppNonStandardHandlers(AppPrinters):
def _is_exit_command(self, command: InputCommand):
if command.get_trigger().lower() == self._exit_command.get_trigger().lower():
@@ -218,15 +227,10 @@ class App(AppSetters, AppNonStandardHandlers, AppSetups):
try:
input_command: InputCommand = InputCommand.parse(raw_command=raw_command)
except BaseInputCommandException as error:
if isinstance(self._dividing_line, StaticDividingLine):
self._print_func(self._dividing_line.get_full_line())
self._error_handler(error, raw_command)
self._print_func(self._dividing_line.get_full_line())
elif isinstance(self._dividing_line, DynamicDividingLine):
with redirect_stdout(io.StringIO()) as f:
self._error_handler(error, raw_command)
res: str = f.getvalue()
self._print_framed_text_with_dynamic_line(res)
self._print_framed_text(res)
continue
if self._is_exit_command(input_command):
@@ -236,17 +240,11 @@ class App(AppSetters, AppNonStandardHandlers, AppSetups):
if self._is_unknown_command(input_command):
continue
if isinstance(self._dividing_line, StaticDividingLine):
self._print_func(self._dividing_line.get_full_line())
for registered_router in self._registered_routers:
registered_router.input_command_handler(input_command)
self._print_func(self._dividing_line.get_full_line())
elif isinstance(self._dividing_line, DynamicDividingLine):
with redirect_stdout(io.StringIO()) as f:
for registered_router in self._registered_routers:
registered_router.input_command_handler(input_command)
res: str = f.getvalue()
self._print_framed_text_with_dynamic_line(res)
self._print_framed_text(res)
if not self._repeat_command_groups_description:
self._print_func(self._prompt)
+3 -1
View File
@@ -19,7 +19,9 @@ def command_help():
help_command()
@work_router.command(Command('start', 'Start Solving', Flags(PredeterminedFlags.HOST, PredeterminedFlags.PORT), aliases=['starting']))
@work_router.command(Command('start', 'Start Solving',
flags=Flags(PredeterminedFlags.HOST, PredeterminedFlags.PORT),
aliases=['starting']))
def command_start_solving(args: InputFlags):
print(args.get_flag('host'))
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "argenta"
version = "0.5.0-beta2"
version = "0.5.0"
description = "Python library for creating TUI"
authors = [
{name = "kolo", email = "kolo.is.main@gmail.com"}