mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 18:15:28 +03:00
fix
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
from typing import Callable, Any
|
from typing import Callable, Any
|
||||||
|
from inspect import getfullargspec
|
||||||
from ..command.entity import Command
|
from ..command.entity import Command
|
||||||
from ..command.input_comand.entity import InputCommand
|
from ..command.input_comand.entity import InputCommand
|
||||||
from ..command.input_comand.exceptions import InvalidInputFlagException
|
from ..command.input_comand.exceptions import InvalidInputFlagException
|
||||||
@@ -50,7 +51,7 @@ class Router:
|
|||||||
input_command_name: str = input_command.get_string_entity()
|
input_command_name: str = input_command.get_string_entity()
|
||||||
for command_entity in self._command_entities:
|
for command_entity in self._command_entities:
|
||||||
if input_command_name.lower() == command_entity['command'].get_string_entity().lower():
|
if input_command_name.lower() == command_entity['command'].get_string_entity().lower():
|
||||||
if self._ignore_command_register:
|
if input_command_name == command_entity['command'].get_string_entity():
|
||||||
if input_command.get_input_flags():
|
if input_command.get_input_flags():
|
||||||
for flag in input_command.get_input_flags():
|
for flag in input_command.get_input_flags():
|
||||||
is_valid = command_entity['command'].validate_input_flag(flag)
|
is_valid = command_entity['command'].validate_input_flag(flag)
|
||||||
@@ -58,17 +59,8 @@ class Router:
|
|||||||
raise InvalidInputFlagException(flag)
|
raise InvalidInputFlagException(flag)
|
||||||
return command_entity['handler_func'](input_command.get_input_flags())
|
return command_entity['handler_func'](input_command.get_input_flags())
|
||||||
else:
|
else:
|
||||||
return command_entity['handler_func']()
|
print(getfullargspec(command_entity['handler_func']))
|
||||||
else:
|
return command_entity['handler_func'](None)
|
||||||
if input_command_name == command_entity['command'].get_string_entity():
|
|
||||||
if input_command.get_input_flags():
|
|
||||||
for flag in input_command.get_input_flags():
|
|
||||||
is_valid = command_entity['command'].validate_input_flag(flag)
|
|
||||||
if not is_valid:
|
|
||||||
raise InvalidInputFlagException(flag)
|
|
||||||
return command_entity['handler_func'](input_command.get_input_flags())
|
|
||||||
else:
|
|
||||||
return command_entity['handler_func']()
|
|
||||||
|
|
||||||
|
|
||||||
def get_unknown_command_func(self):
|
def get_unknown_command_func(self):
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ flagi = FlagsGroup(flags=[
|
|||||||
|
|
||||||
|
|
||||||
@work_router.command(Command(command='0', description='Get Help', flags=flagi))
|
@work_router.command(Command(command='0', description='Get Help', flags=flagi))
|
||||||
def command_help(args: FlagsGroup):
|
def command_help(args: FlagsGroup | None):
|
||||||
print('Help command')
|
print('Help command')
|
||||||
flags = args.get_flags()
|
flags = args.get_flags()
|
||||||
for flag in flags:
|
for flag in flags:
|
||||||
@@ -30,7 +30,7 @@ def command_help(args: FlagsGroup):
|
|||||||
|
|
||||||
|
|
||||||
@work_router.command(Command(command='P', description='Start Solving', flags=flagi))
|
@work_router.command(Command(command='P', description='Start Solving', flags=flagi))
|
||||||
def command_start_solving(args: FlagsGroup):
|
def command_start_solving(args: FlagsGroup | None):
|
||||||
print('Solving...')
|
print('Solving...')
|
||||||
flags = args.get_flags()
|
flags = args.get_flags()
|
||||||
for flag in flags:
|
for flag in flags:
|
||||||
|
|||||||
Reference in New Issue
Block a user