mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 18:15:28 +03:00
v0.3.2
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from ..input_comand.exceptions import IncorrectInputFlagException, RepeatedInputFlagsException
|
||||
from ..input_comand.exceptions import UnprocessedInputFlagException, RepeatedInputFlagsException
|
||||
from ..entity import Command
|
||||
from ..params.flag.flags_group.entity import FlagsGroup
|
||||
from ..params.flag.input_flag.entity import InputFlag
|
||||
@@ -29,12 +29,12 @@ class InputCommand(Command, Generic[T]):
|
||||
if _.startswith('-'):
|
||||
flag_prefix_last_symbol_index = _.rfind('-')
|
||||
if current_flag_name or len(_) < 2 or len(_[:flag_prefix_last_symbol_index]) > 3:
|
||||
raise IncorrectInputFlagException()
|
||||
raise UnprocessedInputFlagException()
|
||||
else:
|
||||
current_flag_name = _
|
||||
else:
|
||||
if not current_flag_name:
|
||||
raise IncorrectInputFlagException()
|
||||
raise UnprocessedInputFlagException()
|
||||
else:
|
||||
current_flag_value = _
|
||||
if current_flag_name and current_flag_value:
|
||||
@@ -55,7 +55,7 @@ class InputCommand(Command, Generic[T]):
|
||||
current_flag_name = None
|
||||
current_flag_value = None
|
||||
if any([current_flag_name, current_flag_value]):
|
||||
raise IncorrectInputFlagException()
|
||||
raise UnprocessedInputFlagException()
|
||||
if len(flags.get_flags()) == 0:
|
||||
return InputCommand(command=command)
|
||||
else:
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
from ..params.flag.input_flag.entity import InputFlag
|
||||
|
||||
|
||||
class InvalidInputFlagException(Exception):
|
||||
def __init__(self, flag: InputFlag):
|
||||
self.flag = flag
|
||||
class UnprocessedInputFlagException(Exception):
|
||||
def __str__(self):
|
||||
return ("Invalid Input Flags\n"
|
||||
f"Unknown or invalid input flag: '{self.flag.get_string_entity()} {self.flag.get_value()}'")
|
||||
|
||||
class IncorrectInputFlagException(Exception):
|
||||
def __str__(self):
|
||||
return "Incorrect Input Flags"
|
||||
return "Unprocessed Input Flags"
|
||||
|
||||
|
||||
class RepeatedInputFlagsException(Exception):
|
||||
@@ -26,12 +19,17 @@ class InvalidInputFlagsHandlerHasBeenAlreadyCreatedException(Exception):
|
||||
return "Invalid Input Flags Handler has already been created"
|
||||
|
||||
|
||||
class RepeatedInputFlagsHandlerHasBeenAlreadyCreatedException(Exception):
|
||||
def __str__(self):
|
||||
return "Repeated Input Flags Handler has already been created"
|
||||
|
||||
|
||||
class UnknownCommandHandlerHasBeenAlreadyCreatedException(Exception):
|
||||
def __str__(self):
|
||||
return "Unknown Command Handler has already been created"
|
||||
|
||||
|
||||
class IncorrectNumberArgsHandlerException(Exception):
|
||||
class IncorrectNumberOfHandlerArgsException(Exception):
|
||||
def __str__(self):
|
||||
return "Incorrect Input Flags Handler has incorrect number of arguments"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user