From 01e6aae836dbb602ac7562bc8a8b86ed6d309590 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 10 Jan 2023 21:46:16 +0200 Subject: [PATCH] Updated for none flags msg --- slpkg/main.py | 3 --- slpkg/views/cli_menu.py | 8 ++++++-- 2 files changed, 6 insertions(+), 5 deletions(-) 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.") +