mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-13 20:01:48 +01:00
Added for case-insensitive to configs
This commit is contained in:
parent
dd25d2d7c7
commit
cc14bcc2f3
3 changed files with 31 additions and 25 deletions
|
@ -55,6 +55,10 @@ PROGRESS_SPINNER = "pixel"
|
||||||
# Default is green. [green/violet/yellow/blue/cyan/grey/red]
|
# Default is green. [green/violet/yellow/blue/cyan/grey/red]
|
||||||
SPINNER_COLOR = "green"
|
SPINNER_COLOR = "green"
|
||||||
|
|
||||||
|
# Enable or disable case-insensitive pattern matching.
|
||||||
|
# Default is false. [true/false]
|
||||||
|
CASE_INSENSITIVE = false
|
||||||
|
|
||||||
# Slackware command for install packages, instead, you can use 'installpkg'.
|
# Slackware command for install packages, instead, you can use 'installpkg'.
|
||||||
# Normally upgradepkg only upgrades packages that are already installed
|
# Normally upgradepkg only upgrades packages that are already installed
|
||||||
# on the system, and will skip any packages that do not already have a
|
# on the system, and will skip any packages that do not already have a
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Configs:
|
||||||
dialog: bool = True
|
dialog: bool = True
|
||||||
downloader: str = 'wget'
|
downloader: str = 'wget'
|
||||||
wget_options: str = '--c -q --progress=bar:force:noscroll --show-progress'
|
wget_options: str = '--c -q --progress=bar:force:noscroll --show-progress'
|
||||||
curl_options: str = ''
|
curl_options: str = str()
|
||||||
lftp_get_options: str = '-c get -e'
|
lftp_get_options: str = '-c get -e'
|
||||||
lftp_mirror_options: str = '-c mirror --parallel=100 --only-newer'
|
lftp_mirror_options: str = '-c mirror --parallel=100 --only-newer'
|
||||||
silent_mode: bool = True
|
silent_mode: bool = True
|
||||||
|
@ -46,10 +46,11 @@ class Configs:
|
||||||
spinning_bar: str = True
|
spinning_bar: str = True
|
||||||
progress_spinner: str = 'pixel'
|
progress_spinner: str = 'pixel'
|
||||||
spinner_color: str = 'green'
|
spinner_color: str = 'green'
|
||||||
|
case_insensitive: bool = False
|
||||||
|
|
||||||
proxy_address: str = ''
|
proxy_address: str = str()
|
||||||
proxy_username: str = ''
|
proxy_username: str = str()
|
||||||
proxy_password: str = ''
|
proxy_password: str = str()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Load user configuration.
|
# Load user configuration.
|
||||||
|
@ -82,6 +83,7 @@ class Configs:
|
||||||
spinning_bar: str = config['SPINNING_BAR']
|
spinning_bar: str = config['SPINNING_BAR']
|
||||||
progress_spinner: str = config['PROGRESS_SPINNER']
|
progress_spinner: str = config['PROGRESS_SPINNER']
|
||||||
spinner_color: str = config['SPINNER_COLOR']
|
spinner_color: str = config['SPINNER_COLOR']
|
||||||
|
case_insensitive: bool = config['CASE_INSENSITIVE']
|
||||||
proxy_address: str = config['PROXY_ADDRESS']
|
proxy_address: str = config['PROXY_ADDRESS']
|
||||||
proxy_username: str = config['PROXY_USERNAME']
|
proxy_username: str = config['PROXY_USERNAME']
|
||||||
proxy_password: str = config['PROXY_PASSWORD']
|
proxy_password: str = config['PROXY_PASSWORD']
|
||||||
|
@ -89,19 +91,19 @@ class Configs:
|
||||||
except (KeyError, tomli.TOMLDecodeError) as error:
|
except (KeyError, tomli.TOMLDecodeError) as error:
|
||||||
errors.raise_toml_error_message(error, toml_file='/etc/slpkg/slpkg.toml')
|
errors.raise_toml_error_message(error, toml_file='/etc/slpkg/slpkg.toml')
|
||||||
|
|
||||||
blink: str = ''
|
blink: str = str()
|
||||||
bold: str = ''
|
bold: str = str()
|
||||||
red: str = ''
|
red: str = str()
|
||||||
bred: str = ''
|
bred: str = str()
|
||||||
green: str = ''
|
green: str = str()
|
||||||
bgreen: str = ''
|
bgreen: str = str()
|
||||||
yellow: str = ''
|
yellow: str = str()
|
||||||
byellow: str = ''
|
byellow: str = str()
|
||||||
cyan: str = ''
|
cyan: str = str()
|
||||||
blue: str = ''
|
blue: str = str()
|
||||||
grey: str = ''
|
grey: str = str()
|
||||||
violet: str = ''
|
violet: str = str()
|
||||||
endc: str = ''
|
endc: str = str()
|
||||||
|
|
||||||
if colors:
|
if colors:
|
||||||
blink: str = '\033[32;5m'
|
blink: str = '\033[32;5m'
|
||||||
|
|
|
@ -616,7 +616,7 @@ class Argparse(Configs):
|
||||||
self.check.is_database_empty()
|
self.check.is_database_empty()
|
||||||
packages: list = self.is_file_list_packages()
|
packages: list = self.is_file_list_packages()
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_no_cases, self.flags):
|
if self.utils.is_option(self.flag_no_cases, self.flags) or self.case_insensitive:
|
||||||
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
|
@ -643,7 +643,7 @@ class Argparse(Configs):
|
||||||
self.check.is_database_empty()
|
self.check.is_database_empty()
|
||||||
packages: list = self.is_file_list_packages()
|
packages: list = self.is_file_list_packages()
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_no_cases, self.flags):
|
if self.utils.is_option(self.flag_no_cases, self.flags) or self.case_insensitive:
|
||||||
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
|
@ -668,7 +668,7 @@ class Argparse(Configs):
|
||||||
self.check.is_database_empty()
|
self.check.is_database_empty()
|
||||||
packages: list = self.is_file_list_packages()
|
packages: list = self.is_file_list_packages()
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_no_cases, self.flags):
|
if self.utils.is_option(self.flag_no_cases, self.flags) or self.case_insensitive:
|
||||||
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
|
@ -703,7 +703,7 @@ class Argparse(Configs):
|
||||||
self.check.is_database_empty()
|
self.check.is_database_empty()
|
||||||
packages: list = self.is_file_list_packages()
|
packages: list = self.is_file_list_packages()
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_no_cases, self.flags):
|
if self.utils.is_option(self.flag_no_cases, self.flags) or self.case_insensitive:
|
||||||
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
|
@ -721,7 +721,7 @@ class Argparse(Configs):
|
||||||
self.check.is_database_empty()
|
self.check.is_database_empty()
|
||||||
packages: list = self.is_file_list_packages()
|
packages: list = self.is_file_list_packages()
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_no_cases, self.flags):
|
if self.utils.is_option(self.flag_no_cases, self.flags) or self.case_insensitive:
|
||||||
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
|
@ -745,7 +745,7 @@ class Argparse(Configs):
|
||||||
self.check.is_database_empty()
|
self.check.is_database_empty()
|
||||||
packages: list = self.is_file_list_packages()
|
packages: list = self.is_file_list_packages()
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_no_cases, self.flags):
|
if self.utils.is_option(self.flag_no_cases, self.flags) or self.case_insensitive:
|
||||||
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
|
@ -763,7 +763,7 @@ class Argparse(Configs):
|
||||||
self.check.is_database_empty()
|
self.check.is_database_empty()
|
||||||
packages: list = self.is_file_list_packages()
|
packages: list = self.is_file_list_packages()
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_no_cases, self.flags):
|
if self.utils.is_option(self.flag_no_cases, self.flags) or self.case_insensitive:
|
||||||
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
|
@ -783,7 +783,7 @@ class Argparse(Configs):
|
||||||
self.check.is_database_empty()
|
self.check.is_database_empty()
|
||||||
packages: list = self.is_file_list_packages()
|
packages: list = self.is_file_list_packages()
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_no_cases, self.flags):
|
if self.utils.is_option(self.flag_no_cases, self.flags) or self.case_insensitive:
|
||||||
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data)
|
||||||
|
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
|
|
Loading…
Reference in a new issue