Added the file pattern in the config

This commit is contained in:
Dimitris Zlatanidis 2023-03-07 22:04:07 +02:00
parent c9865dc9af
commit 085b88b00a
4 changed files with 13 additions and 1 deletions

View file

@ -1,6 +1,7 @@
4.5.6 - 07/03/2023
Added:
- Ignore comments for list.pkgs files (Thanks to rizitis)
- The file pattern in the config file
Updated:
- Ponce repository

View file

@ -28,6 +28,8 @@
# Set false to all the questions. If set false option --yes will not work.
# Default is true. [true/false].
ASK_QUESTION = true
# Pass your file pattern here, instead, you can use '--file-pattern=' option.
FILE_PATTERN = ""
# SLACKBUILDS.ORG REPOSITORY CONFIGS.
SBO_REPO_PATH = "/var/lib/slpkg/repositories/sbo/"

View file

@ -97,6 +97,9 @@ class Configs:
# Set false to all the questions.
ask_question: bool = True
# Pass the file pattern here.
file_pattern_conf: str = ""
# Load configurations from the file.
load = LoadConfigs()
configs = load.file(etc_path, prog_name)
@ -167,6 +170,9 @@ class Configs:
# File suffix for list packages.
file_list_suffix: str = config['FILE_LIST_SUFFIX']
# Pass the file pattern here.
file_pattern_conf: str = config['FILE_PATTERN']
except KeyError as error:
raise SystemExit(f"\nKeyError: {error}: in the configuration file '/etc/slpkg/slpkg.toml'.\n"
f"\nIf you have upgraded the '{prog_name}' probably you need to run:\n"

View file

@ -34,13 +34,16 @@ class Argparse(Configs):
self.args: list = args
self.flags: list = []
self.directory = self.tmp_slpkg
self.file_pattern: str = f'*{self.repo_tag}'
self.dialogbox = DialogBox()
self.utils = Utilities()
self.usage = Usage()
self.check = Check()
self.form_configs = FormConfigs()
self.file_pattern: str = f'*{self.repo_tag}'
if self.file_pattern_conf:
self.file_pattern = self.file_pattern_conf
if len(self.args) == 0:
self.usage.help_short()