new models, a model is passed to the command handler instead of a dictionary, removal of checks for intersection of processed triggers in handlers and much, much more

This commit is contained in:
2025-03-31 19:14:42 +03:00
parent 2918bc9f81
commit 5c6fa5151a
24 changed files with 283 additions and 279 deletions
+4 -3
View File
@@ -1,14 +1,15 @@
from typing import Callable
from argenta.command import Command
from argenta.command.flag.models import InputFlags
class CommandHandler:
def __init__(self, handler: Callable[[], None] | Callable[[dict], None], handled_command: Command):
def __init__(self, handler: Callable[[], None] | Callable[[InputFlags], None], handled_command: Command):
self.handler = handler
self.handled_command = handled_command
def handling(self, input_flags: dict = None):
if input_flags is not None:
def handling(self, input_flags: InputFlags):
if input_flags.get_flags():
self.handler(input_flags)
else:
self.handler()