Updated for new configs

This commit is contained in:
Dimitris Zlatanidis 2023-04-26 08:22:45 +03:00
parent 664d1528a9
commit 913dc12056
4 changed files with 49 additions and 9 deletions

10
bin/slpkg_new-configs Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from slpkg.new_configs import main
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
raise SystemExit(1)

View file

@ -1,13 +1,14 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import shutil
import difflib
import subprocess
from pathlib import Path
class NewConfig:
class NewConfigs:
def __init__(self, options: list):
__slots__ = 'options'
@ -255,3 +256,34 @@ class NewConfig:
output = subprocess.call(f'vimdiff {file1} {file2}', shell=True)
if output != 0:
raise SystemExit(output)
def main():
args = sys.argv
args.pop(0)
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)
try:
config = NewConfigs(args)
config.check()
except KeyboardInterrupt:
raise SystemExit(1)

View file

@ -12,4 +12,4 @@ class TomlErrors:
raise SystemExit(f"\n{self.tool_name}: Error: {error}: in the configuration\n"
f"file '{toml_file}', edit the file and check for errors,\n"
f"or if you have upgraded the '{self.tool_name}' maybe you need to run:\n"
f"\n $ slpkg new-config\n")
f"\n $ slpkg_new-config\n")

View file

@ -26,11 +26,10 @@ class Usage(Configs):
args: str = (
f'Usage: {self.prog_name} [{self.cyan}COMMAND{self.endc}] [{self.yellow}OPTIONS{self.endc}] '
f'[FILELIST|PACKAGES...]\n'
f'\n slpkg [{self.cyan}COMMAND{self.endc}] [-u, update, -U, upgrade, -c, check-updates]\n'
f' slpkg [{self.cyan}COMMAND{self.endc}] [-I, repo-info, -L, clean-logs, -T, clean-data]\n'
f' slpkg [{self.cyan}COMMAND{self.endc}] [-D, clean-tmp, -g, configs, -x, new-config]\n'
f' slpkg [{self.cyan}COMMAND{self.endc}] [-b, build, -i, install, -d, download [packages...]]\n'
f' slpkg [{self.cyan}COMMAND{self.endc}] [-R, remove, -f, find, -w, view [packages...]]\n'
f'\n slpkg [{self.cyan}COMMAND{self.endc}] [-u, update, -U, upgrade, -c, check-updates, -I, repo-info]\n'
f' slpkg [{self.cyan}COMMAND{self.endc}] [-g, configs, -L, clean-logs, -T, clean-data, -D, clean-tmp]\n'
f' slpkg [{self.cyan}COMMAND{self.endc}] [-b, build, -i, install, -R, remove [packages...]]\n'
f' slpkg [{self.cyan}COMMAND{self.endc}] [-d, download, -f, find, -w, view [packages...]]\n'
f' slpkg [{self.cyan}COMMAND{self.endc}] [-s, search, -e, dependees, -t, tracking [packages...]]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-y, --yes, -j, --jobs, -o, --resolve-off, -r, --reinstall]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-k, --skip-installed, -E, --full-reverse, -S, --search]\n'
@ -54,14 +53,13 @@ class Usage(Configs):
f' {self.cyan}-c, check-updates{self.endc} Check for news on ChangeLog.txt.\n'
f' {self.cyan}-I, repo-info{self.endc} Prints the repositories information.\n'
f' {self.cyan}-g, configs{self.endc} Edit the configuration file.\n'
f' {self.cyan}-x, new-config{self.endc} Search for new configuration files.\n'
f' {self.cyan}-L, clean-logs{self.endc} Clean dependencies log tracking.\n'
f' {self.cyan}-T, clean-data{self.endc} Clean all the repositories data.\n'
f' {self.cyan}-D, clean-tmp{self.endc} Delete all the downloaded sources.\n'
f' {self.cyan}-b, build{self.endc} [packages...] Build only the packages.\n'
f' {self.cyan}-i, install{self.endc} [packages...] Build and install the packages.\n'
f' {self.cyan}-d, download{self.endc} [packages...] Download only the scripts and sources.\n'
f' {self.cyan}-R, remove{self.endc} [packages...] Remove installed packages.\n'
f' {self.cyan}-d, download{self.endc} [packages...] Download only the scripts and sources.\n'
f' {self.cyan}-f, find{self.endc} [packages...] Find installed packages.\n'
f' {self.cyan}-w, view{self.endc} [packages...] View packages from the repository.\n'
f' {self.cyan}-s, search{self.endc} [packages...] Search packages from the repository.\n'