diff --git a/slpkg/main.py b/slpkg/main.py index e7ad7cd1..c3758aa8 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -342,6 +342,9 @@ class Argparse(Configs): if opt not in options: invalid.append(opt) except (KeyError, IndexError): + logger = logging.getLogger(__name__) + logger.exception('%s: %s:', self.__class__.__name__, + self.__class__.invalid_options.__name__) self.usage.help_short(1) # Prints error for invalid options. @@ -383,6 +386,9 @@ class Argparse(Configs): try: self.directory: str = self.args[self.args.index(arg) + 1] except IndexError: + logger = logging.getLogger(__name__) + logger.exception('%s: %s:', self.__class__.__name__, + self.__class__.split_options_from_args.__name__) self.directory: Path = self.tmp_slpkg else: self.args.remove(self.directory) @@ -395,6 +401,9 @@ class Argparse(Configs): try: self.binary_repo: str = self.args[self.args.index(arg) + 1] except IndexError: + logger = logging.getLogger(__name__) + logger.exception('%s: %s:', self.__class__.__name__, + self.__class__.split_options_from_args.__name__) self.binary_repo = '' else: self.args.remove(self.binary_repo) @@ -769,6 +778,9 @@ class Argparse(Configs): flags = self.commands[self.args[1]] Help(self.args[1], flags).view() except KeyError: + logger = logging.getLogger(__name__) + logger.exception('%s: %s:', self.__class__.__name__, + self.__class__.help_for_commands.__name__) self.usage.help_minimal(f"{self.prog_name}: invalid argument '{''.join(self.args[1])}'") else: self.usage.help_short(1)