Updated for cli

This commit is contained in:
Dimitris Zlatanidis 2023-03-14 20:21:09 +02:00
parent f6be71a65d
commit deeaae364c

View file

@ -59,7 +59,7 @@ class NewConfig:
""" Checks for .new files. """
print('Checking for NEW configuration files...')
if self.slpkg_config_new.is_file() or self.blacklist_config_new.is_file():
print('There are NEW files:\n')
print('\nThere are NEW files:\n')
if self.slpkg_config_new.is_file():
print(f"{self.bgreen:>12}{self.slpkg_config_new}{self.endc}")
@ -205,11 +205,26 @@ class NewConfig:
if __name__ == '__main__':
args = sys.argv
args.pop(0)
if '--help' in args or '-h' in args:
print('slpkg_new-configs [OPTIONS]\n'
'\n--no-colors Disable the output colors.\n'
'-h, --help Show this message and exit.\n')
sys.exit()
options: list = [
'--no-colors',
'-h', '--help'
]
if len(args) == 1:
if options[1] in args or options[2] in args:
print('slpkg_new-configs [OPTIONS]\n'
'\n --no-colors Disable the output colors.\n'
' -h, --help Show this message and exit.\n')
sys.exit()
elif args[0] == options[0]:
pass
else:
print('\ntry: slpkg_new-configs --help\n')
sys.exit(1)
elif len(args) > 1:
print('\ntry: slpkg_new-configs --help\n')
sys.exit(1)
config = NewConfig(args)
config.check()