diff --git a/ChangeLog.txt b/ChangeLog.txt index adcdb52e..7a4ccbf7 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,6 +2,8 @@ Updated: - Download first all the slackbuilds - Rename view_mode to silent_mode +Added: +- Option --no-silent 4.4.9 - 13/01/2023 Updated: diff --git a/README.rst b/README.rst index 092c87f4..178c985c 100644 --- a/README.rst +++ b/README.rst @@ -87,6 +87,7 @@ Usage --skip-installed Skip installed packages. --full-reverse Full reverse dependency. --search Search packages from the repository. + --no-silent Disable silent mode. -h, --help Show this message and exit. -v, --version Print version and exit. diff --git a/slpkg/download_only.py b/slpkg/download_only.py index 15740d29..eaee19ab 100644 --- a/slpkg/download_only.py +++ b/slpkg/download_only.py @@ -32,12 +32,12 @@ class Download: location = SBoQueries(sbo).location() url = f'{self.configs.sbo_repo_url}/{location}/{file}' - down_sbo = Downloader(self.configs.download_only, url) + down_sbo = Downloader(self.configs.download_only, url, self.flags) down_sbo.download() sources = SBoQueries(sbo).sources() for source in sources: - down_source = Downloader(self.configs.download_only, source) + down_source = Downloader(self.configs.download_only, source, self.flags) down_source.download() elapsed_time = time.time() - start diff --git a/slpkg/downloader.py b/slpkg/downloader.py index b9c8c5c9..7b96d6c2 100644 --- a/slpkg/downloader.py +++ b/slpkg/downloader.py @@ -13,9 +13,11 @@ from slpkg.progress_bar import ProgressBar class Downloader: """ Wget downloader. """ - def __init__(self, path: Union[str, Path], url: str): + def __init__(self, path: Union[str, Path], url: str, flags: list): self.path = path self.url = url + self.flags = flags + self.flag_no_silent = '--no-silent' self.filename = url.split('/')[-1] self.configs = Configs self.colors = self.configs.colour @@ -50,7 +52,8 @@ class Downloader: def download(self): """ Starting multiprocessing download process. """ - if self.configs.silent_mode: + if self.configs.silent_mode and self.flag_no_silent not in self.flags: + done = f' {self.byellow} Done{self.endc}' self.stderr = subprocess.DEVNULL self.stdout = subprocess.DEVNULL diff --git a/slpkg/main.py b/slpkg/main.py index 22794584..16364fa6 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -50,6 +50,7 @@ class Argparse: self.flag_skip_installed = '--skip-installed' self.flag_full_reverse = '--full-reverse' self.flag_search = '--search' + self.flag_no_silent = '--no-silent' self.is_dialog_enabled() @@ -59,7 +60,8 @@ class Argparse: self.flag_reinstall, self.flag_skip_installed, self.flag_full_reverse, - self.flag_search] + self.flag_search, + self.flag_no_silent] self.remove_flags() @@ -78,7 +80,7 @@ class Argparse: "in the '/etc/slpkg/' folder.\n") def check_for_flags(self, command): - """ Check for correct flag. """ + """ Check for correct flags. """ commands = { '--help': [], @@ -88,7 +90,8 @@ class Argparse: self.flag_yes, self.flag_jobs, self.flag_resolve_off, - self.flag_reinstall + self.flag_reinstall, + self.flag_no_silent ], 'check-updates': [], 'configs': [], @@ -98,7 +101,8 @@ class Argparse: self.flag_yes, self.flag_jobs, self.flag_resolve_off, - self.flag_search + self.flag_search, + self.flag_no_silent ], 'install': [ self.flag_yes, @@ -106,16 +110,19 @@ class Argparse: self.flag_resolve_off, self.flag_reinstall, self.flag_skip_installed, - self.flag_search + self.flag_search, + self.flag_no_silent ], 'download': [ self.flag_yes, - self.flag_search + self.flag_search, + self.flag_no_silent ], 'remove': [ self.flag_yes, self.flag_resolve_off, - self.flag_search + self.flag_search, + self.flag_no_silent ], 'find': [self.flag_search], 'view': [self.flag_search], diff --git a/slpkg/remove_packages.py b/slpkg/remove_packages.py index ea363a27..0e60c8b6 100644 --- a/slpkg/remove_packages.py +++ b/slpkg/remove_packages.py @@ -34,6 +34,7 @@ class RemovePackages: self.utils = Utilities() self.progress = ProgressBar() self.flag_resolve_off = '--resolve-off' + self.flag_no_silent = '--no-silent' self.output = 0 self.remove_pkg = None self.stderr = None @@ -83,7 +84,8 @@ class RemovePackages: def multi_process(self, command, package): """ Starting multiprocessing remove process. """ - if self.configs.silent_mode: + if self.configs.silent_mode and self.flag_no_silent not in self.flags: + done = f' {self.byellow} Done{self.endc}' message = f'{self.red}Remove{self.endc}' self.stderr = subprocess.DEVNULL diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 58e74f9c..675ce287 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -55,6 +55,7 @@ class Slackbuilds: self.flag_skip_installed = '--skip-installed' self.flag_resolve_off = '--resolve-off' self.flag_jobs = '--jobs' + self.flag_no_silent = '--no-silent' def execute(self): """ Starting build or install the slackbuilds. """ @@ -138,7 +139,7 @@ class Slackbuilds: location = SBoQueries(sbo).location() url = f'{self.configs.sbo_repo_url}/{location}/{file}' - down_sbo = Downloader(self.configs.tmp_slpkg, url) + down_sbo = Downloader(self.configs.tmp_slpkg, url, self.flags) down_sbo.download() self.utils.untar_archive(self.configs.tmp_slpkg, file, self.configs.build_path) @@ -262,7 +263,7 @@ class Slackbuilds: checksums = SBoQueries(name).checksum() for source, checksum in zip(sources, checksums): - down_source = Downloader(path, source) + down_source = Downloader(path, source, self.flags) down_source.download() md5sum = Md5sum(self.flags) @@ -270,7 +271,8 @@ class Slackbuilds: def multi_process(self, command, filename, message): """ Starting multiprocessing install/upgrade process. """ - if self.configs.silent_mode: + if self.configs.silent_mode and self.flag_no_silent not in self.flags: + done = f' {self.byellow} Done{self.endc}' self.stderr = subprocess.DEVNULL self.stdout = subprocess.DEVNULL diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 13fe06d6..ba5ffdf6 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -26,7 +26,7 @@ class Usage: f' slpkg [{self.cyan}COMMAND{self.endc}] [-f, find, -w, view, -s, search, -e, dependees] \n' f' slpkg [{self.cyan}COMMAND{self.endc}] [-t, tracking] \n' f' slpkg [{self.yellow}OPTIONS{self.endc}] [--yes, --jobs, --resolve-off, --reinstall]\n' - f' slpkg [{self.yellow}OPTIONS{self.endc}] [--skip-installed, --full-reverse, --search]\n' + f' slpkg [{self.yellow}OPTIONS{self.endc}] [--skip-installed, --full-reverse, --search, --no-silent]\n' " \nIf you need more information please try 'slpkg --help'.") print(args) @@ -62,6 +62,7 @@ class Usage: f' {self.yellow}--skip-installed{self.endc} Skip installed packages.\n' f' {self.yellow}--full-reverse{self.endc} Full reverse dependency.\n' f' {self.yellow}--search{self.endc} Search packages from the repository.\n' + f' {self.yellow}--no-silent{self.endc} Disable silent mode.\n' '\n -h, --help Show this message and exit.\n' ' -v, --version Print version and exit.\n' '\nEdit the configuration file in the /etc/slpkg/slpkg.toml \n' @@ -81,4 +82,3 @@ class Usage: f"please use: \n{self.yellow}'{', '.join(flags)}'{self.endc}") raise SystemExit(f"{self.red}Error:{self.endc} Got an unexpected extra option.") -