mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-05 11:02:14 +01:00
Updated blacklist prints
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
71e530d66d
commit
86957fb9e6
1 changed files with 7 additions and 4 deletions
|
@ -67,30 +67,33 @@ class BlackList(Utils):
|
|||
def black_listed(self):
|
||||
"""Print blacklist packages
|
||||
"""
|
||||
print("Packages in the blacklist:\n")
|
||||
print("Packages in the blacklist:")
|
||||
for black in list(self.black_filter()):
|
||||
if black:
|
||||
print(f"{self.green}{black}{self.endc}")
|
||||
print()
|
||||
|
||||
def black_add(self, pkgs):
|
||||
"""Add blacklist packages if not exist
|
||||
"""
|
||||
blacklist = list(self.black_filter())
|
||||
pkgs = set(pkgs)
|
||||
print("Add packages in the blacklist:\n")
|
||||
print("Add packages in the blacklist:")
|
||||
with open(self.blackfile, "a") as black_conf:
|
||||
for pkg in pkgs:
|
||||
if pkg not in blacklist:
|
||||
print(f"{self.green}{pkg}{self.endc}")
|
||||
black_conf.write(pkg + "\n")
|
||||
print()
|
||||
|
||||
def black_remove(self, pkgs):
|
||||
"""Remove packages from blacklist
|
||||
"""
|
||||
print("Remove packages from the blacklist:\n")
|
||||
print("Remove packages from the blacklist:")
|
||||
with open(self.blackfile, "w") as remove:
|
||||
for line in self.black_conf.splitlines():
|
||||
if line not in pkgs:
|
||||
remove.write(line + "\n")
|
||||
else:
|
||||
print(f"{self.red}{line}{self.endc}")
|
||||
print(f"{self.red}{line}{self.endc}")
|
||||
print()
|
||||
|
|
Loading…
Reference in a new issue