diff --git a/slpkg/main.py b/slpkg/main.py index 82a559d2..8e38753c 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -271,6 +271,7 @@ class Argparse(Configs): commands: list = [] options: list = [] invalid: list = [] + error: int = 0 for arg in self.args: if arg in self.options: @@ -287,18 +288,21 @@ class Argparse(Configs): # Avoid to combine two or more options. if len(options) != len(set(options)): - print(f"{self.prog_name}: you added the same {', '.join(options)} options.") - self.usage.help_minimal() + print(f"{self.prog_name}: you added the same \'{', '.join(options)}\' options.") + error: int = 1 # Avoid to combine two or more commands. if len(commands) > 1: - print(f"{self.prog_name}: you can't combine {', '.join(commands)} commands.") - self.usage.help_minimal() + print(f"{self.prog_name}: you can't combine \'{', '.join(commands)}\' commands.") + error: int = 1 # Prints error for invalid options. if invalid: for opt in invalid: print(f"{self.prog_name}: invalid option '{opt}'") + error: int = 1 + + if error: self.usage.help_minimal() def split_options(self) -> None: