diff --git a/slpkg/main.py b/slpkg/main.py index 9182cbf4..17438488 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -334,14 +334,6 @@ class Argparse(Configs): self.args.remove(opt) self.flags.append(opt) - def check_for_flags(self, command: str) -> None: - """ Check for correct flags. """ - flags: list = self.commands[command] - - for opt in self.flags: - if opt not in flags and opt not in ['--help', '--version']: - self.usage.error_for_options(command, flags) - def is_file_list_packages(self): """ Checks if the arg is filelist.pkgs. """ if self.args[1].endswith(self.file_list_suffix): @@ -717,7 +709,6 @@ def main(): } try: - argparse.check_for_flags(args[0]) arguments[args[0]]() except (KeyError, IndexError): usage.help_short() diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 0c361e23..4a5a456e 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -92,16 +92,3 @@ class Usage(Configs): print(args) raise SystemExit(status) - - def error_for_options(self, command: str, flags: list) -> NoReturn: - """ Error messages for flags. """ - flags.reverse() # Put first the short options. - print(f'Usage: {self.prog_name} [{self.yellow}OPTIONS{self.endc}] ' - f'[{self.cyan}COMMAND{self.endc}] [FILELIST|PACKAGES...]\n' - f"Try 'slpkg --help' for help.\n") - - print(f"{self.bold}{self.red}Error:{self.endc} Got an unexpected extra option.\n" - f"\n{self.bold}COMMAND:{self.endc} {self.cyan}{command}{self.endc}" - f"\n{self.bold}OPTIONS:{self.endc} {self.yellow}{', '.join(flags)}{self.endc}\n") - print('If you need more information try to use slpkg manpage.') - raise SystemExit(1)