Updated for short

This commit is contained in:
Dimitris Zlatanidis 2023-02-27 13:22:08 +02:00
parent d1881235da
commit a212c01bd9
2 changed files with 7 additions and 4 deletions

View file

@ -77,11 +77,12 @@ class Usage(Configs):
print(args)
raise SystemExit(status)
def error_for_options(self, flags):
def error_for_options(self, flags: list):
""" Error messages for flags. """
print(f'Usage: {Configs.prog_name} [{self.yellow}OPTIONS{self.endc}] '
flags.reverse() # Put first the short options.
print(f'Usage: {self.prog_name} [{self.yellow}OPTIONS{self.endc}] '
f'[{self.cyan}COMMAND{self.endc}] <packages>\n'
f"Try 'slpkg --help' for help.\n")
raise SystemExit(f"{self.red}Error:{self.endc} Got an unexpected extra option.\n"
f"Try to use: {', '.join(flags)}")
f"\nTry to use: {', '.join(flags)}")

View file

@ -6,7 +6,7 @@ from slpkg.configs import Configs
class Help(Configs):
def __init__(self, command, flags):
def __init__(self, command: str, flags: list):
super(Configs, self).__init__()
self.command = command
self.flags = flags
@ -20,6 +20,8 @@ class Help(Configs):
self.endc = color['endc']
def view(self):
self.flags.reverse() # Put first the short options.
help_commands = {
'update': "Updates the package list and the database.",
'upgrade': "Upgrade all the installed packages if the newer version exists in the repository.",