Removed unused method

This commit is contained in:
Dimitris Zlatanidis 2023-03-16 21:45:29 +02:00
parent 0b3e813dd1
commit f683d8cf6c
2 changed files with 0 additions and 22 deletions

View file

@ -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()

View file

@ -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)