mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 18:15:28 +03:00
work on docs, tests and some fix
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
from rich.console import Console
|
||||
from ...business_logic.word2num_math import word2num_math
|
||||
|
||||
|
||||
console = Console()
|
||||
print_line_separator = lambda: console.print('\n[bold blue]--------------------------------------[/bold blue]\n')
|
||||
|
||||
|
||||
def start_solving_command():
|
||||
while True:
|
||||
console.print(
|
||||
"\n[italic]Enter a string expression or [bold italic green] Q [/bold italic green] for exit:[/italic]")
|
||||
string_expression = input()
|
||||
if string_expression.lower() == 'q':
|
||||
break
|
||||
else:
|
||||
print_line_separator()
|
||||
console.print(
|
||||
f'[bold green]Answer:[/bold green] [bold blue]{word2num_math(string_expression)}[/bold blue]')
|
||||
print_line_separator()
|
||||
@@ -1,26 +0,0 @@
|
||||
import requests
|
||||
from rich.console import Console
|
||||
from ...business_logic.script_updater import UpdateScript
|
||||
|
||||
|
||||
console = Console()
|
||||
print_line_separator = lambda: console.print('\n[bold green]--------------------------------------[/bold green]\n')
|
||||
|
||||
|
||||
def upgrade_command():
|
||||
try:
|
||||
requests.get('https://ya.ru')
|
||||
except requests.exceptions.ConnectionError:
|
||||
console.print('[bold red]No internet connection[/bold red]')
|
||||
else:
|
||||
latest_tag = UpdateScript.start_update()
|
||||
if latest_tag:
|
||||
print_line_separator()
|
||||
console.print(f"[bold yellow]The newest version ({latest_tag}) of the script has been successfully installed![/bold yellow]")
|
||||
print_line_separator()
|
||||
console.print("[bold yellow]Rerun the script for the changes to take effect[/bold yellow]")
|
||||
print_line_separator()
|
||||
exit(0)
|
||||
else:
|
||||
console.print('[bold red]You have the latest version installed[/bold red]')
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
import re
|
||||
from pprint import pprint
|
||||
|
||||
from rich.console import Console
|
||||
|
||||
from argenta.command.entity import Command
|
||||
from argenta.command.params.flag.entity import Flag
|
||||
from argenta.command.params.flag.flags_group.entity import FlagsGroup
|
||||
from argenta.router import Router
|
||||
from .handlers_implementation.help_command import help_command
|
||||
|
||||
|
||||
work_router: Router = Router(title='Work nts:')
|
||||
work_router.set_invalid_input_flag_handler(lambda flag: print(f'Invalid input flag: "{flag.get_string_entity()} {flag.get_value()}"'))
|
||||
|
||||
settings_router: Router = Router(title='Settings points:')
|
||||
|
||||
|
||||
console = Console()
|
||||
|
||||
flagi = FlagsGroup(flags=[
|
||||
|
||||
flags = FlagsGroup(flags=[
|
||||
Flag(flag_name='host',
|
||||
flag_prefix='--',
|
||||
possible_flag_values=re.compile(r'^192.168.\d{1,3}.\d{1,3}$')),
|
||||
@@ -23,33 +27,21 @@ flagi = FlagsGroup(flags=[
|
||||
])
|
||||
|
||||
|
||||
@work_router.command(Command(command='0', description='Get Help'))
|
||||
@work_router.command(Command(trigger='0', description='Get Help'))
|
||||
def command_help():
|
||||
print('Help command')
|
||||
'''flags = args.get_flags()
|
||||
for flag in flags:
|
||||
print(f'name: "{flag.get_string_entity()}", value: "{flag.get_value()}"')'''
|
||||
#help_command()
|
||||
help_command()
|
||||
|
||||
|
||||
@work_router.command(Command(command='P', description='Start Solving', flags=flagi))
|
||||
def command_start_solving(argrrtrts: dict):
|
||||
@work_router.command(Command(trigger='P', description='Start Solving', flags=flags))
|
||||
def command_start_solving(args: dict):
|
||||
print('Solving...')
|
||||
pprint(argrrtrts)
|
||||
pprint(args)
|
||||
#start_solving_command()
|
||||
|
||||
|
||||
@settings_router.command(Command(command='G', description='Update WordMath'))
|
||||
@settings_router.command(Command(trigger='G', description='Update WordMath'))
|
||||
def command_update():
|
||||
print('uefi')
|
||||
# upgrade_command()
|
||||
|
||||
|
||||
def invalid_input_flag(flag: Flag):
|
||||
print(f'Invalid inpuuuuuuuuuuuuuuuuuuuuuuuut flag: "{flag.get_string_entity()} {flag.get_value()}"')
|
||||
|
||||
|
||||
work_router.set_invalid_input_flag_handler(invalid_input_flag)
|
||||
print('Command update')
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user