Updated for none flags msg

This commit is contained in:
Dimitris Zlatanidis 2023-01-10 21:46:16 +02:00
parent ef53f4e768
commit 01e6aae836
2 changed files with 6 additions and 5 deletions

View file

@ -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']:

View file

@ -76,5 +76,9 @@ class Usage:
print(f'Usage: {Configs.prog_name} [{self.yellow}OPTIONS{self.endc}] '
f'[{self.cyan}COMMAND{self.endc}] <packages>')
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.")