From 92730ac2cc6bce5ae1626625816aab447c90c4d8 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 9 Jan 2023 18:10:26 +0200 Subject: [PATCH 01/21] Added comments --- slpkg/views/views.py | 1 + 1 file changed, 1 insertion(+) diff --git a/slpkg/views/views.py b/slpkg/views/views.py index 8fd729f0..1faf5c0a 100644 --- a/slpkg/views/views.py +++ b/slpkg/views/views.py @@ -91,6 +91,7 @@ class ViewMessage: print(f'{self.bold}{self.green}{self.llc}' + f'{self.hl}' * (self.columns - 2) + f'{self.lrc}{self.endc}') def view_skipping_packages(self, sbo, version): + """ Print the skipping packages. """ print(f'[{self.yellow}Skipping{self.endc}] {sbo}-{version} {self.red}(already installed){self.endc}') def build_packages(self, slackbuilds: list, dependencies: list): From d3465166a8de3b957decdb41da49dfa64a1b55e4 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 9 Jan 2023 19:11:03 +0200 Subject: [PATCH 02/21] Switch to glob module --- slpkg/utilities.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/slpkg/utilities.py b/slpkg/utilities.py index 3401c004..5e5014ca 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- -import os +import glob import time import shutil import tarfile @@ -24,10 +24,16 @@ class Utilities: def is_installed(self, name: str) -> str: """ Returns the installed package name. """ - for package in os.listdir(self.configs.log_packages): + pattern = f'{str(self.configs.log_packages)}/*{self.configs.sbo_repo_tag}' + packages = glob.glob(pattern) + + for package in packages: + package = package.split('/')[-1] pkg = self.split_installed_pkg(package)[0] - if pkg == name and self.configs.sbo_repo_tag in package and pkg not in self.black.get(): + + if pkg == name and pkg not in self.black.get(): return package + return '' @staticmethod From e736bcb0269c747db41d91d6759799c4408888a5 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 9 Jan 2023 19:43:16 +0200 Subject: [PATCH 03/21] Updated glob from pathlib module --- slpkg/slackbuild.py | 8 +++----- slpkg/utilities.py | 8 ++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 7c64240d..f6e0d403 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -249,12 +249,10 @@ class Slackbuilds: installation. """ version = SBoQueries(name).version() - packages = [] - pkg = f'{name}-{version}' + pattern = f'{name}-{version}-*{self.configs.sbo_repo_tag}*' - for package in os.listdir(self.configs.tmp_path): - if pkg in package and self.configs.sbo_repo_tag in package: - packages.append(package) + tmp = Path(self.configs.tmp_path) + packages = [file.name for file in tmp.glob(pattern)] return max(packages) diff --git a/slpkg/utilities.py b/slpkg/utilities.py index 5e5014ca..08087649 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- -import glob import time import shutil import tarfile @@ -24,11 +23,12 @@ class Utilities: def is_installed(self, name: str) -> str: """ Returns the installed package name. """ - pattern = f'{str(self.configs.log_packages)}/*{self.configs.sbo_repo_tag}' - packages = glob.glob(pattern) + pattern = f'*{self.configs.sbo_repo_tag}' + + var_log_packages = Path(self.configs.log_packages) + packages = [file.name for file in var_log_packages.glob(pattern)] for package in packages: - package = package.split('/')[-1] pkg = self.split_installed_pkg(package)[0] if pkg == name and pkg not in self.black.get(): From a6c7e8b9661571f0ad89469b24c1b63be241e365 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 9 Jan 2023 19:48:59 +0200 Subject: [PATCH 04/21] Updated for pathlib module --- slpkg/views/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/slpkg/views/views.py b/slpkg/views/views.py index 1faf5c0a..99789479 100644 --- a/slpkg/views/views.py +++ b/slpkg/views/views.py @@ -4,6 +4,7 @@ import os import shutil from typing import Any +from pathlib import Path from distutils.version import LooseVersion from slpkg.configs import Configs @@ -180,7 +181,10 @@ class ViewMessage: def _view_removed(self, name: str): """ View and creates list with packages for remove. """ - installed = os.listdir(self.configs.log_packages) + pattern = f'*{self.configs.sbo_repo_tag}' + + var_log_packages = Path(self.configs.log_packages) + installed = [file.name for file in var_log_packages.glob(pattern)] if self.utils.is_installed(name): for package in installed: From 80c43f38510213f741106bf0db2639ab17d58c28 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 9 Jan 2023 20:06:12 +0200 Subject: [PATCH 05/21] Merge to utilities method --- slpkg/find_installed.py | 9 +++++---- slpkg/main.py | 9 ++++----- slpkg/upgrade.py | 5 +++-- slpkg/utilities.py | 9 ++++++++- slpkg/views/views.py | 6 +----- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/slpkg/find_installed.py b/slpkg/find_installed.py index a6d756de..b5d1eb0b 100644 --- a/slpkg/find_installed.py +++ b/slpkg/find_installed.py @@ -1,9 +1,8 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- -import os - from slpkg.configs import Configs +from slpkg.utilities import Utilities class FindInstalled: @@ -13,17 +12,19 @@ class FindInstalled: self.configs = Configs colors = self.configs.colour self.color = colors() + self.utils = Utilities() def find(self, packages: list): """ Find the packages. """ matching = [] + installed = self.utils.all_installed() print(f'The list below shows the installed packages ' f'that contains \'{", ".join([p for p in packages])}\' files:\n') for pkg in packages: - for package in os.listdir(self.configs.log_packages): - if pkg in package and self.configs.sbo_repo_tag in package: + for package in installed: + if pkg in package: matching.append(package) self.matched(matching) diff --git a/slpkg/main.py b/slpkg/main.py index 2c82f227..cbc3d54d 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -96,7 +96,7 @@ class Argparse: repo_packages = SBoQueries('').sbos() # Grab all the installed packages - installed = os.listdir(self.configs.log_packages) + installed = self.utils.all_installed() if method in ['remove', 'find']: @@ -104,10 +104,9 @@ class Argparse: name = self.utils.split_installed_pkg(package)[0] version = self.utils.split_installed_pkg(package)[1] - if package.endswith(self.configs.sbo_repo_tag): - for pkg in packages: - if pkg in name: - choices += [(name, version, False)] + for pkg in packages: + if pkg in name: + choices += [(name, version, False)] else: for package in repo_packages: for pkg in packages: diff --git a/slpkg/upgrade.py b/slpkg/upgrade.py index a8e6a0f8..0bbbaac7 100644 --- a/slpkg/upgrade.py +++ b/slpkg/upgrade.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- -import os from distutils.version import LooseVersion @@ -27,7 +26,9 @@ class Upgrade: black = Blacklist().get() upgrade, requires = [], [] - for pkg in os.listdir(self.configs.log_packages): + installed = self.utils.all_installed() + + for pkg in installed: inst_pkg_name = self.utils.split_installed_pkg(pkg)[0] if (pkg.endswith(self.configs.sbo_repo_tag) diff --git a/slpkg/utilities.py b/slpkg/utilities.py index 08087649..eba30100 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -33,9 +33,16 @@ class Utilities: if pkg == name and pkg not in self.black.get(): return package - return '' + def all_installed(self): + """ Return all installed SBo packages from /val/log/packages folder. """ + pattern = f'*{self.configs.sbo_repo_tag}' + var_log_packages = Path(self.configs.log_packages) + installed = [file.name for file in var_log_packages.glob(pattern)] + + return installed + @staticmethod def untar_archive(path: str, archive: str, ext_path: str): """ Untar the file to the build folder. """ diff --git a/slpkg/views/views.py b/slpkg/views/views.py index 99789479..37173cab 100644 --- a/slpkg/views/views.py +++ b/slpkg/views/views.py @@ -4,7 +4,6 @@ import os import shutil from typing import Any -from pathlib import Path from distutils.version import LooseVersion from slpkg.configs import Configs @@ -181,10 +180,7 @@ class ViewMessage: def _view_removed(self, name: str): """ View and creates list with packages for remove. """ - pattern = f'*{self.configs.sbo_repo_tag}' - - var_log_packages = Path(self.configs.log_packages) - installed = [file.name for file in var_log_packages.glob(pattern)] + installed = self.utils.all_installed() if self.utils.is_installed(name): for package in installed: From 1f088e971061d6dde7f5a710ac22da700f8458ef Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 9 Jan 2023 20:08:37 +0200 Subject: [PATCH 06/21] Updated changelog --- ChangeLog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 4a3c5b4c..6f60ef31 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,6 +3,8 @@ Added: - Finished report to download only - The French manpage (Thanks to marav) - Check if the file dowwnload +Updated: +- os.istdir method with pathlib module 4.4.6 - 06/01/2023 Updated: From 0ffd28a1314c2de8b52d76289ec07f5ea0dc233b Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 9 Jan 2023 20:31:55 +0200 Subject: [PATCH 07/21] Updated for version 4.4.7 Signed-off-by: Dimitris Zlatanidis --- README.rst | 4 ++-- setup.cfg | 2 +- slpkg/views/version.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 3fdf3fee..995933ae 100644 --- a/README.rst +++ b/README.rst @@ -31,8 +31,8 @@ Install from the official third-party `SBo repository Date: Mon, 9 Jan 2023 22:31:00 +0200 Subject: [PATCH 08/21] Updated for flags error --- slpkg/main.py | 162 ++++++++++++++++++++++++---------------- slpkg/views/cli_menu.py | 5 ++ 2 files changed, 102 insertions(+), 65 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index cbc3d54d..1aae426b 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -75,7 +75,7 @@ class Argparse: """ Checking if the dialog box is enabled. """ if (not self.configs.dialog and self.flag_search in self.args or not self.configs.dialog and 'configs' in self.args): - print("Error: You should enable the dialog " + print("ERROR: You should enable the dialog " "in the '/etc/slpkg/' folder.\n") self.usage.help(1) @@ -84,7 +84,7 @@ class Argparse: for opt in self.args: if opt.startswith('--'): if opt not in self.options and opt not in ['--help', '--version']: - raise SystemExit(f"\nError: flag '{opt}' does not exist.\n") + raise SystemExit(f"\nERROR: flag '{opt}' does not exist.\n") def choose_packages(self, packages, method): """ Choose packages with dialog utility and --search flag. """ @@ -162,11 +162,16 @@ class Argparse: self.usage.help(1) def upgrade(self): - if [f for f in self.flags if f not in [self.flag_yes, - self.flag_jobs, - self.flag_resolve_off, - self.flag_reinstall]]: - self.usage.help(1) + command = Argparse.upgrade.__name__ + upgrade_flags = [ + self.flag_yes, + self.flag_jobs, + self.flag_resolve_off, + self.flag_reinstall + ] + + if [f for f in self.flags if f not in upgrade_flags]: + self.usage.error_for_options(command, upgrade_flags) if len(self.args) == 1: self.check.database() @@ -174,15 +179,13 @@ class Argparse: upgrade = Upgrade() packages = list(upgrade.packages()) - packages = self.choose_packages(packages, - Argparse.upgrade.__name__) + packages = self.choose_packages(packages, command) if not packages: print('\nEverything is up-to-date.\n') raise SystemExit() - install = Slackbuilds(packages, self.flags, - mode=Argparse.upgrade.__name__) + install = Slackbuilds(packages, self.flags, mode=command) install.execute() raise SystemExit() self.usage.help(1) @@ -203,8 +206,11 @@ class Argparse: self.usage.help(1) def clean_logs(self): - if [f for f in self.flags if f not in [self.flag_yes]]: - self.usage.help(1) + command = Argparse.clean_logs.__name__ + clean_logs_flags = [self.flag_yes] + + if [f for f in self.flags if f not in clean_logs_flags]: + self.usage.error_for_options(command, clean_logs_flags) if len(self.args) == 1: self.check.database() @@ -226,66 +232,76 @@ class Argparse: self.usage.help(1) def build(self): - if [f for f in self.flags if f not in [self.flag_yes, - self.flag_jobs, - self.flag_resolve_off, - self.flag_search]]: - self.usage.help(1) + command = Argparse.build.__name__ + build_flags = [ + self.flag_yes, + self.flag_jobs, + self.flag_resolve_off, + self.flag_search + ] + + if [f for f in self.flags if f not in build_flags]: + self.usage.error_for_options(command, build_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) if '--search' in self.flags: - packages = self.choose_packages(packages, - Argparse.build.__name__) + packages = self.choose_packages(packages, command) self.check.database() self.check.exists(packages) self.check.unsupported(packages) - build = Slackbuilds(packages, self.flags, - mode=Argparse.build.__name__) + build = Slackbuilds(packages, self.flags, mode=command) build.execute() raise SystemExit() self.usage.help(1) def install(self): - if [f for f in self.flags if f not in [self.flag_yes, - self.flag_jobs, - self.flag_resolve_off, - self.flag_reinstall, - self.flag_skip_installed, - self.flag_search]]: - self.usage.help(1) + command = Argparse.install.__name__ + install_flags = [ + self.flag_yes, + self.flag_jobs, + self.flag_resolve_off, + self.flag_reinstall, + self.flag_skip_installed, + self.flag_search + ] + + if [f for f in self.flags if f not in install_flags]: + self.usage.error_for_options(command, install_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) if '--search' in self.flags: - packages = self.choose_packages(packages, - Argparse.install.__name__) + packages = self.choose_packages(packages, command) self.check.database() self.check.exists(packages) self.check.unsupported(packages) - install = Slackbuilds(packages, self.flags, - mode=Argparse.install.__name__) + install = Slackbuilds(packages, self.flags, mode=command) install.execute() raise SystemExit() self.usage.help(1) def download(self): - if [f for f in self.flags if f not in [self.flag_yes, - self.flag_search]]: - self.usage.help(1) + command = Argparse.download.__name__ + download_flags = [ + self.flag_yes, + self.flag_search + ] + + if [f for f in self.flags if f not in download_flags]: + self.usage.error_for_options(command, download_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) if '--search' in self.flags: - packages = self.choose_packages(packages, - Argparse.download.__name__) + packages = self.choose_packages(packages, command) self.check.database() self.check.exists(packages) @@ -295,17 +311,21 @@ class Argparse: self.usage.help(1) def remove(self): - if [f for f in self.flags if f not in [self.flag_yes, - self.flag_resolve_off, - self.flag_search]]: - self.usage.help(1) + command = Argparse.remove.__name__ + remove_flags = [ + self.flag_yes, + self.flag_resolve_off, + self.flag_search + ] + + if [f for f in self.flags if f not in remove_flags]: + self.usage.error_for_options(command, remove_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) if '--search' in self.flags: - packages = self.choose_packages(packages, - Argparse.remove.__name__) + packages = self.choose_packages(packages, command) self.check.database() packages = self.check.installed(packages) @@ -316,15 +336,17 @@ class Argparse: self.usage.help(1) def find(self): - if [f for f in self.flags if f not in [self.flag_search]]: - self.usage.help(1) + command = Argparse.find.__name__ + find_flags = [self.flag_search] + + if [f for f in self.flags if f not in find_flags]: + self.usage.error_for_options(command, find_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) if '--search' in self.flags: - packages = self.choose_packages(packages, - Argparse.find.__name__) + packages = self.choose_packages(packages, command) self.check.database() @@ -334,15 +356,17 @@ class Argparse: self.usage.help(1) def view(self): - if [f for f in self.flags if f not in [self.flag_search]]: - self.usage.help(1) + command = Argparse.view.__name__ + view_flags = [self.flag_search] + + if [f for f in self.flags if f not in view_flags]: + self.usage.error_for_options(command, view_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) if '--search' in self.flags: - packages = self.choose_packages(packages, - Argparse.view.__name__) + packages = self.choose_packages(packages, command) self.check.database() self.check.exists(packages) @@ -353,15 +377,17 @@ class Argparse: self.usage.help(1) def search(self): - if [f for f in self.flags if f not in [self.flag_search]]: - self.usage.help(1) + command = Argparse.search.__name__ + search_flags = [self.flag_search] + + if [f for f in self.flags if f not in search_flags]: + self.usage.error_for_options(command, search_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) if '--search' in self.flags: - packages = self.choose_packages(packages, - Argparse.search.__name__) + packages = self.choose_packages(packages, command) self.check.database() @@ -371,16 +397,20 @@ class Argparse: self.usage.help(1) def dependees(self): - if [f for f in self.flags if f not in [self.flag_full_reverse, - self.flag_search]]: - self.usage.help(1) + command = Argparse.dependees.__name__ + dependees_flags = [ + self.flag_full_reverse, + self.flag_search + ] + + if [f for f in self.flags if f not in dependees_flags]: + self.usage.error_for_options(command, dependees_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) if '--search' in self.flags: - packages = self.choose_packages(packages, - Argparse.dependees.__name__) + packages = self.choose_packages(packages, command) self.check.database() self.check.exists(packages) @@ -391,15 +421,17 @@ class Argparse: self.usage.help(1) def tracking(self): - if [f for f in self.flags if f not in [self.flag_search]]: - self.usage.help(1) + command = Argparse.tracking.__name__ + tracking_flags = [self.flag_search] + + if [f for f in self.flags if f not in tracking_flags]: + self.usage.error_for_options(command, tracking_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) if '--search' in self.flags: - packages = self.choose_packages(packages, - Argparse.tracking.__name__) + packages = self.choose_packages(packages, command) self.check.database() self.check.exists(packages) diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index c8454b93..b8ad1690 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -70,3 +70,8 @@ class Usage: print(args) raise SystemExit(status) + + def error_for_options(self, command, flags): + """ Error message for flags. """ + raise SystemExit(f"\n{self.red}ERROR:{self.endc} Available [{self.yellow}OPTIONS{self.endc}] for " + f"{command} [{self.cyan}COMMAND{self.endc}]: \n{', '.join(flags)}\n") From 1af73e6656c3cd02672151bb623385072e7fc872 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 9 Jan 2023 22:38:30 +0200 Subject: [PATCH 09/21] Updated for flags error --- slpkg/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index 1aae426b..809f5fa0 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -152,8 +152,11 @@ class Argparse: self.usage.help(1) def update(self): - if [f for f in self.flags if f not in [self.flag_yes]]: - self.usage.help(1) + command = Argparse.upgrade.__name__ + update_flags = [self.flag_yes] + + if [f for f in self.flags if f not in update_flags]: + self.usage.error_for_options(command, update_flags) if len(self.args) == 1: update = UpdateRepository(self.flags) From dc2ab708a323647d35c34141665885ecbd16c235 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 10 Jan 2023 17:42:05 +0200 Subject: [PATCH 10/21] Updated for flags error --- slpkg/main.py | 30 ++++++++++++++---------------- slpkg/views/cli_menu.py | 6 +++--- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index 809f5fa0..27a363eb 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -75,7 +75,7 @@ class Argparse: """ Checking if the dialog box is enabled. """ if (not self.configs.dialog and self.flag_search in self.args or not self.configs.dialog and 'configs' in self.args): - print("ERROR: You should enable the dialog " + print("Error: You should enable the dialog " "in the '/etc/slpkg/' folder.\n") self.usage.help(1) @@ -84,7 +84,7 @@ class Argparse: for opt in self.args: if opt.startswith('--'): if opt not in self.options and opt not in ['--help', '--version']: - raise SystemExit(f"\nERROR: flag '{opt}' does not exist.\n") + raise SystemExit(f"\nError: flag '{opt}' does not exist.\n") def choose_packages(self, packages, method): """ Choose packages with dialog utility and --search flag. """ @@ -152,11 +152,10 @@ class Argparse: self.usage.help(1) def update(self): - command = Argparse.upgrade.__name__ update_flags = [self.flag_yes] if [f for f in self.flags if f not in update_flags]: - self.usage.error_for_options(command, update_flags) + self.usage.error_for_options(update_flags) if len(self.args) == 1: update = UpdateRepository(self.flags) @@ -174,7 +173,7 @@ class Argparse: ] if [f for f in self.flags if f not in upgrade_flags]: - self.usage.error_for_options(command, upgrade_flags) + self.usage.error_for_options(upgrade_flags) if len(self.args) == 1: self.check.database() @@ -209,11 +208,10 @@ class Argparse: self.usage.help(1) def clean_logs(self): - command = Argparse.clean_logs.__name__ clean_logs_flags = [self.flag_yes] if [f for f in self.flags if f not in clean_logs_flags]: - self.usage.error_for_options(command, clean_logs_flags) + self.usage.error_for_options(clean_logs_flags) if len(self.args) == 1: self.check.database() @@ -244,7 +242,7 @@ class Argparse: ] if [f for f in self.flags if f not in build_flags]: - self.usage.error_for_options(command, build_flags) + self.usage.error_for_options(build_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -273,7 +271,7 @@ class Argparse: ] if [f for f in self.flags if f not in install_flags]: - self.usage.error_for_options(command, install_flags) + self.usage.error_for_options(install_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -298,7 +296,7 @@ class Argparse: ] if [f for f in self.flags if f not in download_flags]: - self.usage.error_for_options(command, download_flags) + self.usage.error_for_options(download_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -322,7 +320,7 @@ class Argparse: ] if [f for f in self.flags if f not in remove_flags]: - self.usage.error_for_options(command, remove_flags) + self.usage.error_for_options(remove_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -343,7 +341,7 @@ class Argparse: find_flags = [self.flag_search] if [f for f in self.flags if f not in find_flags]: - self.usage.error_for_options(command, find_flags) + self.usage.error_for_options(find_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -363,7 +361,7 @@ class Argparse: view_flags = [self.flag_search] if [f for f in self.flags if f not in view_flags]: - self.usage.error_for_options(command, view_flags) + self.usage.error_for_options(view_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -384,7 +382,7 @@ class Argparse: search_flags = [self.flag_search] if [f for f in self.flags if f not in search_flags]: - self.usage.error_for_options(command, search_flags) + self.usage.error_for_options(search_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -407,7 +405,7 @@ class Argparse: ] if [f for f in self.flags if f not in dependees_flags]: - self.usage.error_for_options(command, dependees_flags) + self.usage.error_for_options(dependees_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -428,7 +426,7 @@ class Argparse: tracking_flags = [self.flag_search] if [f for f in self.flags if f not in tracking_flags]: - self.usage.error_for_options(command, tracking_flags) + self.usage.error_for_options(tracking_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index b8ad1690..07e0885c 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -71,7 +71,7 @@ class Usage: print(args) raise SystemExit(status) - def error_for_options(self, command, flags): + def error_for_options(self, flags): """ Error message for flags. """ - raise SystemExit(f"\n{self.red}ERROR:{self.endc} Available [{self.yellow}OPTIONS{self.endc}] for " - f"{command} [{self.cyan}COMMAND{self.endc}]: \n{', '.join(flags)}\n") + raise SystemExit(f"\n{self.red}Error:{self.endc} Got an unexpected extra option, " + f"please use: \n{self.yellow}{', '.join(flags)}{self.endc}\n") From 9f598b51e8f5695dfc7660cbedbf0ddab7b60269 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 10 Jan 2023 17:46:16 +0200 Subject: [PATCH 11/21] Added usage --- slpkg/views/cli_menu.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 07e0885c..d236fa7e 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -73,5 +73,8 @@ class Usage: def error_for_options(self, flags): """ Error message for flags. """ - raise SystemExit(f"\n{self.red}Error:{self.endc} Got an unexpected extra option, " + print(f'Usage: {Configs.prog_name} [{self.yellow}OPTIONS{self.endc}] ' + f'[{self.cyan}COMMAND{self.endc}] ') + 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}\n") From 0b2147d4b0b1b87a9e08314aab5ec6354631caca Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 10 Jan 2023 17:54:49 +0200 Subject: [PATCH 12/21] Remove colors --- slpkg/views/cli_menu.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index d236fa7e..c78cc305 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -71,10 +71,9 @@ class Usage: print(args) raise SystemExit(status) - def error_for_options(self, flags): + @staticmethod + def error_for_options(flags): """ Error message for flags. """ - print(f'Usage: {Configs.prog_name} [{self.yellow}OPTIONS{self.endc}] ' - f'[{self.cyan}COMMAND{self.endc}] ') + print(f'Usage: {Configs.prog_name} [OPTIONS] [COMMAND] ') 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}\n") + raise SystemExit(f"Error: Got an unexpected extra option, please use: \n{', '.join(flags)}") From 19124d2bcafa158f290de05e3b2e1e2cbd8d0e96 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 10 Jan 2023 20:09:33 +0200 Subject: [PATCH 13/21] Merge flags options --- slpkg/main.py | 154 +++++++++++++++++++--------------------- slpkg/views/cli_menu.py | 9 +-- 2 files changed, 77 insertions(+), 86 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index 27a363eb..87a4e93e 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -61,7 +61,6 @@ class Argparse: self.flag_full_reverse, self.flag_search] - self.check_for_flags() self.remove_flags() def remove_flags(self): @@ -79,12 +78,79 @@ class Argparse: "in the '/etc/slpkg/' folder.\n") self.usage.help(1) - def check_for_flags(self): + def check_for_flags(self, command): """ Check for correct flag. """ - for opt in self.args: + + commands = { + '--help': [], + '--version': [], + 'update': [self.flag_yes], + 'upgrade': [ + self.flag_yes, + self.flag_jobs, + self.flag_resolve_off, + self.flag_reinstall + ], + 'check-updates': [], + 'configs': [], + 'clean-logs': [self.flag_yes], + 'clean-tmp': [], + 'build': [ + self.flag_yes, + self.flag_jobs, + self.flag_resolve_off, + self.flag_search + ], + 'install': [ + self.flag_yes, + self.flag_jobs, + self.flag_resolve_off, + self.flag_reinstall, + self.flag_skip_installed, + self.flag_search + ], + 'download': [ + self.flag_yes, + self.flag_search + ], + 'remove': [ + self.flag_yes, + self.flag_resolve_off, + self.flag_search + ], + 'find': [self.flag_search], + 'view': [self.flag_search], + 'search': [self.flag_search], + 'dependees': [ + self.flag_full_reverse, + self.flag_search + ], + 'tracking': [self.flag_search] + } + + commands['-h'] = commands['--help'] + commands['-v'] = commands['--version'] + commands['-b'] = commands['build'] + commands['-i'] = commands['install'] + commands['-d'] = commands['download'] + commands['-r'] = commands['remove'] + commands['-f'] = commands['find'] + commands['-w'] = commands['view'] + commands['-s'] = commands['search'] + commands['-e'] = commands['dependees'] + commands['-t'] = commands['tracking'] + + flags = commands[command] + + for opt in self.flags: if opt.startswith('--'): - if opt not in self.options and opt not in ['--help', '--version']: - raise SystemExit(f"\nError: flag '{opt}' does not exist.\n") + if opt not in flags and opt not in ['--help', '--version']: + self.usage.error_for_options(flags) + + for arg in self.args: + if arg.startswith('--'): + if arg not in self.options and arg not in ['--help', '--version']: + self.usage.error_for_options(flags) def choose_packages(self, packages, method): """ Choose packages with dialog utility and --search flag. """ @@ -152,11 +218,6 @@ class Argparse: self.usage.help(1) def update(self): - update_flags = [self.flag_yes] - - if [f for f in self.flags if f not in update_flags]: - self.usage.error_for_options(update_flags) - if len(self.args) == 1: update = UpdateRepository(self.flags) update.repository() @@ -165,15 +226,6 @@ class Argparse: def upgrade(self): command = Argparse.upgrade.__name__ - upgrade_flags = [ - self.flag_yes, - self.flag_jobs, - self.flag_resolve_off, - self.flag_reinstall - ] - - if [f for f in self.flags if f not in upgrade_flags]: - self.usage.error_for_options(upgrade_flags) if len(self.args) == 1: self.check.database() @@ -208,11 +260,6 @@ class Argparse: self.usage.help(1) def clean_logs(self): - clean_logs_flags = [self.flag_yes] - - if [f for f in self.flags if f not in clean_logs_flags]: - self.usage.error_for_options(clean_logs_flags) - if len(self.args) == 1: self.check.database() @@ -234,15 +281,6 @@ class Argparse: def build(self): command = Argparse.build.__name__ - build_flags = [ - self.flag_yes, - self.flag_jobs, - self.flag_resolve_off, - self.flag_search - ] - - if [f for f in self.flags if f not in build_flags]: - self.usage.error_for_options(build_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -261,17 +299,6 @@ class Argparse: def install(self): command = Argparse.install.__name__ - install_flags = [ - self.flag_yes, - self.flag_jobs, - self.flag_resolve_off, - self.flag_reinstall, - self.flag_skip_installed, - self.flag_search - ] - - if [f for f in self.flags if f not in install_flags]: - self.usage.error_for_options(install_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -290,13 +317,6 @@ class Argparse: def download(self): command = Argparse.download.__name__ - download_flags = [ - self.flag_yes, - self.flag_search - ] - - if [f for f in self.flags if f not in download_flags]: - self.usage.error_for_options(download_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -313,14 +333,6 @@ class Argparse: def remove(self): command = Argparse.remove.__name__ - remove_flags = [ - self.flag_yes, - self.flag_resolve_off, - self.flag_search - ] - - if [f for f in self.flags if f not in remove_flags]: - self.usage.error_for_options(remove_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -338,10 +350,6 @@ class Argparse: def find(self): command = Argparse.find.__name__ - find_flags = [self.flag_search] - - if [f for f in self.flags if f not in find_flags]: - self.usage.error_for_options(find_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -358,10 +366,6 @@ class Argparse: def view(self): command = Argparse.view.__name__ - view_flags = [self.flag_search] - - if [f for f in self.flags if f not in view_flags]: - self.usage.error_for_options(view_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -379,10 +383,6 @@ class Argparse: def search(self): command = Argparse.search.__name__ - search_flags = [self.flag_search] - - if [f for f in self.flags if f not in search_flags]: - self.usage.error_for_options(search_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -399,13 +399,6 @@ class Argparse: def dependees(self): command = Argparse.dependees.__name__ - dependees_flags = [ - self.flag_full_reverse, - self.flag_search - ] - - if [f for f in self.flags if f not in dependees_flags]: - self.usage.error_for_options(dependees_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -423,10 +416,6 @@ class Argparse: def tracking(self): command = Argparse.tracking.__name__ - tracking_flags = [self.flag_search] - - if [f for f in self.flags if f not in tracking_flags]: - self.usage.error_for_options(tracking_flags) if len(self.args) >= 2: packages = list(set(self.args[1:])) @@ -481,6 +470,7 @@ def main(): } try: + argparse.check_for_flags(args[0]) arguments[args[0]]() except KeyError: Usage().help(1) diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index c78cc305..88ad79be 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -71,9 +71,10 @@ class Usage: print(args) raise SystemExit(status) - @staticmethod - def error_for_options(flags): + def error_for_options(self, flags): """ Error message for flags. """ - print(f'Usage: {Configs.prog_name} [OPTIONS] [COMMAND] ') + print(f'Usage: {Configs.prog_name} [{self.yellow}OPTIONS{self.endc}] ' + f'[{self.cyan}COMMAND{self.endc}] ') print("Try 'slpkg --help' for help.\n") - raise SystemExit(f"Error: Got an unexpected extra option, please use: \n{', '.join(flags)}") + raise SystemExit(f"{self.red}Error:{self.endc} Got an unexpected extra option, " + f"please use: \n{self.yellow}{', '.join(flags)}{self.endc}") From ef53f4e768ba882d6656e21511c13c7ace4981fd Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 10 Jan 2023 20:22:25 +0200 Subject: [PATCH 14/21] Updated for error flags --- slpkg/main.py | 13 ++++++++----- slpkg/views/cli_menu.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index 87a4e93e..202f2979 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -142,6 +142,9 @@ 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']: @@ -206,12 +209,12 @@ class Argparse: return tags def help(self): - if len(self.args) == 1 and not self.flags: + if len(self.args) == 1: self.usage.help(0) self.usage.help(1) def version(self): - if len(self.args) == 1 and not self.flags: + if len(self.args) == 1: version = Version() version.view() raise SystemExit() @@ -245,7 +248,7 @@ class Argparse: self.usage.help(1) def check_updates(self): - if len(self.args) == 1 and not self.flags: + if len(self.args) == 1: self.check.database() check = CheckUpdates() @@ -254,7 +257,7 @@ class Argparse: self.usage.help(1) def edit_configs(self): - if len(self.args) == 1 and not self.flags: + if len(self.args) == 1: self.form_configs.edit() raise SystemExit() self.usage.help(1) @@ -269,7 +272,7 @@ class Argparse: self.usage.help(1) def clean_tmp(self): - if len(self.args) == 1 and not self.flags: + if len(self.args) == 1: path = self.configs.tmp_path tmp_slpkg = self.configs.tmp_slpkg folder = self.configs.prog_name diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 88ad79be..270ac6a1 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -77,4 +77,4 @@ class Usage: f'[{self.cyan}COMMAND{self.endc}] ') 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}") + f"please use: \n{self.yellow}'{', '.join(flags)}'{self.endc}") From 01e6aae836dbb602ac7562bc8a8b86ed6d309590 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 10 Jan 2023 21:46:16 +0200 Subject: [PATCH 15/21] Updated for none flags msg --- slpkg/main.py | 3 --- slpkg/views/cli_menu.py | 8 ++++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index 202f2979..44c61400 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -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']: diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 270ac6a1..2ff55081 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -76,5 +76,9 @@ class Usage: print(f'Usage: {Configs.prog_name} [{self.yellow}OPTIONS{self.endc}] ' f'[{self.cyan}COMMAND{self.endc}] ') 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.") + From cb5e1b7e2be724a34bbdb6aae7ade18a0c7a39bd Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 10 Jan 2023 22:24:32 +0200 Subject: [PATCH 16/21] Remove args check --- slpkg/main.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index 44c61400..a9ae3a8d 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -143,14 +143,8 @@ class Argparse: flags = commands[command] for opt in self.flags: - if opt.startswith('--'): - if opt not in flags and opt not in ['--help', '--version']: - self.usage.error_for_options(flags) - - for arg in self.args: - if arg.startswith('--'): - if arg not in self.options and arg not in ['--help', '--version']: - self.usage.error_for_options(flags) + if opt not in flags and opt not in ['--help', '--version']: + self.usage.error_for_options(flags) def choose_packages(self, packages, method): """ Choose packages with dialog utility and --search flag. """ From 8ce1289e386d8c5fd7a8bcc765b4601fd74e1248 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 10 Jan 2023 22:26:41 +0200 Subject: [PATCH 17/21] Fix typo --- slpkg/views/cli_menu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 2ff55081..13fe06d6 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -72,7 +72,7 @@ class Usage: raise SystemExit(status) def error_for_options(self, flags): - """ Error message for flags. """ + """ Error messages for flags. """ print(f'Usage: {Configs.prog_name} [{self.yellow}OPTIONS{self.endc}] ' f'[{self.cyan}COMMAND{self.endc}] ') print("Try 'slpkg --help' for help.\n") From eba825bb01688c6e46296cd538f57c0ad726aa39 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 10 Jan 2023 22:30:14 +0200 Subject: [PATCH 18/21] Fixed message --- slpkg/main.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index a9ae3a8d..c2e28733 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -51,7 +51,7 @@ class Argparse: self.flag_full_reverse = '--full-reverse' self.flag_search = '--search' - self.dialog_is_enabled() + self.is_dialog_enabled() self.options = [self.flag_yes, self.flag_jobs, @@ -70,13 +70,12 @@ class Argparse: self.args.remove(opt) self.flags.append(opt) - def dialog_is_enabled(self): + def is_dialog_enabled(self): """ Checking if the dialog box is enabled. """ if (not self.configs.dialog and self.flag_search in self.args or not self.configs.dialog and 'configs' in self.args): - print("Error: You should enable the dialog " - "in the '/etc/slpkg/' folder.\n") - self.usage.help(1) + raise SystemExit("\nError: You should enable the dialog " + "in the '/etc/slpkg/' folder.\n") def check_for_flags(self, command): """ Check for correct flag. """ From 8ab2be3615ee03466adb26435246c391a7161f19 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 10 Jan 2023 23:06:38 +0200 Subject: [PATCH 19/21] Updated manpages Signed-off-by: Dimitris Zlatanidis --- man/slpkg-fr.1 | 32 ++++++++++++++++---------------- man/slpkg.1 | 34 +++++++++++++++++----------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/man/slpkg-fr.1 b/man/slpkg-fr.1 index 05ecd1fd..e2c15aed 100644 --- a/man/slpkg-fr.1 +++ b/man/slpkg-fr.1 @@ -1,4 +1,4 @@ -.TH slpkg 1 "Orestiada, Grèce" "slpkg 4.4.0" dslackw +.TH slpkg 1 "Orestiada, Grèce" "slpkg 4.4.7" dslackw .SH NOM .P slpkg - [OPTIONS] [COMMANDE] . @@ -17,78 +17,78 @@ Il calcule automatiquement \fBles dépendances\fP et détermine comment doit se Il utilise également les instructions de \fBSlackware Linux\fP pour l'installation, la mise à jour ou la suppression des paquets. .SH COMMANDES .P -update +.B update --yes .RS Met à jour la liste des paquets et la base de données. .RE .P -upgrade +.B upgrade --yes, --jobs, --resolve-off, --reinstall .RS Met à niveau tous les paquets installés si une version plus récente existe dans le référentiel. .RE .P -check-updates +.B check-updates .RS Vérifie si le fichier \fBChangeLog.txt\fP du SlackBuild contient des mises à jour. .RE .P -configs +.B configs .RS Modifier le fichier de configuration \fB/etc/slpkg/slpkg.toml\fP. .RE .P -clean-logs +.B clean-logs --yes .RS Nettoie les journaux de suivi de dépendances. \fBAttention\fP, après cette procédure vous devrez supprimer les dépendances à la main. .RE .P -clean-tmp +.B clean-tmp .RS Supprime tous les scripts et sources des SlackBuilds téléchargés. .RE .P --b, build +.B -b, build --yes, --jobs, --resolve-off, --search .RS Construit les scripts des Slackbuilds et les ajoute au répertoire \fB/tmp\fP. .RE .P --i, install +.B -i, install --yes, --jobs, --resolve-off, --reinstall, --skip-installed, --search .RS Construit et installe les paquets dans l'ordre adéquat et enregistre également les paquets avec les dépendances à utiliser pour la suppression. .RE .P --d, download +.B -d, download --yes, --search .RS Télécharger les scripts et les sources des SlackBuilds sans les construire ni les installer. .RE .P --r, remove +.B -r, remove --yes, resolve-off, --search .RS Supprime les paquets avec leurs dépendances s'ils ont été installés avec la méthode \fB'slpkg install'\fP. Slpkg examine la configuration \fB'sbo_repo_tag'\fP pour trouver les paquets à supprimer. .RE .P --f, find +.B -f, find --search .RS Trouver les paquets installés par \fBSBo\fP (taggés _SBo) sur votre distribution. .RE .P --w, view +.B -w, view --search .RS Voir les paquets du dépôt et obtenir toutes les informations dans le terminal. .RE .P --s, search +.B -s, search --search .RS Rechercher les paquets. .RE .P --e, dependees +.B -e, dependees --full-reverse, --search .RS Montre les dépendances du paquet. .RE .P --t, tracking +.B -t, tracking --search .RS Suivi des dépendances des paquets. .RE diff --git a/man/slpkg.1 b/man/slpkg.1 index 3e409ed4..7fc6cef3 100644 --- a/man/slpkg.1 +++ b/man/slpkg.1 @@ -1,4 +1,4 @@ -.TH slpkg 1 "Orestiada, Greece" "slpkg 4.4.0" dslackw +.TH slpkg 1 "Orestiada, Greece" "slpkg 4.4.7" dslackw .SH NAME .P slpkg - [OPTIONS] [COMMAND] @@ -17,78 +17,78 @@ Slpkg works in accordance with the standards of the organization SlackBuilds.org Also uses the Slackware Linux instructions for installation, upgrading or removing packages. .SH COMMANDS .P -update +.B update --yes .RS Updates the package list and the database. .RE .P -upgrade +.B upgrade --yes, --jobs, --resolve-off, --reinstall .RS Upgrade all the installed packages if the newer version exists in the repository. .RE .P -check-updates +.B check-updates .RS Check if there is any news on the SlackBuild's ChangeLog.txt file. .RE .P -configs +.B configs .RS Edit the configuration /etc/slpkg/slpkg.toml file. .RE .P -clean-logs +.B clean-logs --yes .RS Cleans dependencies log tracking. After that procedure you should remove dependencies by hand. .RE .P -clean-tmp +.B clean-tmp .RS Deletes all the downloaded SlackBuilds scripts and sources. .RE .P --b, build +.B -b, build --yes, --jobs, --resolve-off, --search .RS Builds the Slackbuilds scripts and adds them to the /tmp directory. .RE .P --i, install +.B -i, install --yes, --jobs, --resolve-off, --reinstall, --skip-installed, --search .RS Builds and installs the packages in the correct order and also logs the packages with dependencies to use for removal. .RE .P --d, download +.B -d, download --yes, --search .RS Download the SlackBuilds scripts and the sources without building or installing it. .RE .P --r, remove +.B -r, remove --yes, resolve-off, --search .RS Removes packages with dependencies if the packages was installed with 'slpkg install' method. Slpkg looks at the 'sbo_repo_tag' configuration to find packages for removal. .RE .P --f, find +.B -f, find --search .RS Find sbo installed packages on your distribution. .RE .P --w, view +.B -w, view --search .RS View packages from the repository and get everything in your terminal. .RE .P --s, search +.B -s, search --search .RS Search and match packages from the repository. .RE .P --e, dependees +.B -e, dependees --full-reverse, --search .RS Show which SlackBuilds depend on. .RE .P --t, tracking +.B -t, tracking --search .RS Tracking the packages dependencies. .RE @@ -150,7 +150,7 @@ Configuration file in the /etc/slpkg/slpkg.toml file. Blacklist file in the /etc/slpkg/blacklist.toml file. .SH REPORT BUGS .P -Please report any found to https://gitlab.com/dslackw/slpkg/-/issues. +Please report any found to: https://gitlab.com/dslackw/slpkg/-/issues. .SH AUTHOR .P Dimitris Zlatanidis From 8c31e0ccba639f096666e5516d37775d843ec159 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 11 Jan 2023 00:11:53 +0200 Subject: [PATCH 20/21] Added bash completion --- completion/slpkg | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 completion/slpkg diff --git a/completion/slpkg b/completion/slpkg new file mode 100644 index 00000000..5fd21179 --- /dev/null +++ b/completion/slpkg @@ -0,0 +1,33 @@ +_slpkg_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + case $cur in + -*) + OPTS=" + --help + --version + update + upgrade + check-updates + configs + clean-logs + clean-tmp + build + install + download + remove + find + view + search + dependees + tracking + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + return 0 +} +complete -F _slpkg_module slpkg From 65c2da6c34570ee1e8928c36b7f899e0c52e38e4 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 11 Jan 2023 18:07:36 +0200 Subject: [PATCH 21/21] Updated manpages Signed-off-by: Dimitris Zlatanidis --- man/slpkg-fr.1 | 2 +- man/slpkg.1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/slpkg-fr.1 b/man/slpkg-fr.1 index e2c15aed..09a7aa84 100644 --- a/man/slpkg-fr.1 +++ b/man/slpkg-fr.1 @@ -1,7 +1,7 @@ .TH slpkg 1 "Orestiada, Grèce" "slpkg 4.4.7" dslackw .SH NOM .P -slpkg - [OPTIONS] [COMMANDE] . +.B slpkg - [OPTIONS] [COMMANDE] . .SH SYNOPSIS .P slpkg [-h|-v] [update] [upgrade] [check-updates] [configs] [clean-logs] [clean-tmp] [-b, build] [-i, install] [-d, download] diff --git a/man/slpkg.1 b/man/slpkg.1 index 7fc6cef3..82e346c3 100644 --- a/man/slpkg.1 +++ b/man/slpkg.1 @@ -1,7 +1,7 @@ .TH slpkg 1 "Orestiada, Greece" "slpkg 4.4.7" dslackw .SH NAME .P -slpkg - [OPTIONS] [COMMAND] +.B slpkg - [OPTIONS] [COMMAND] .SH SYNAPSES .P slpkg [-h|-v] [update] [upgrade] [check-updates] [configs] [clean-logs] [clean-tmp] [-b, build] [-i, install] [-d, download]