diff --git a/slpkg/main.py b/slpkg/main.py index 202f2979..44c61400 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -142,9 +142,6 @@ class Argparse: flags = commands[command] - if not flags: - flags = ['Only the command: ' + command] - for opt in self.flags: if opt.startswith('--'): if opt not in flags and opt not in ['--help', '--version']: diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 270ac6a1..2ff55081 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -76,5 +76,9 @@ class Usage: print(f'Usage: {Configs.prog_name} [{self.yellow}OPTIONS{self.endc}] ' f'[{self.cyan}COMMAND{self.endc}] ') print("Try 'slpkg --help' for help.\n") - raise SystemExit(f"{self.red}Error:{self.endc} Got an unexpected extra option, " - f"please use: \n{self.yellow}'{', '.join(flags)}'{self.endc}") + if flags: + raise SystemExit(f"{self.red}Error:{self.endc} Got an unexpected extra option, " + f"please use: \n{self.yellow}'{', '.join(flags)}'{self.endc}") + + raise SystemExit(f"{self.red}Error:{self.endc} Got an unexpected extra option.") +