Updated blacklist prints

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2022-05-12 20:15:12 +03:00
parent 71e530d66d
commit 86957fb9e6

View file

@ -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()