Add some tweaks that helps to install theme globally

This commit is contained in:
Vladyslav Hroshev
2023-12-16 18:02:21 +02:00
parent dc6c31041f
commit da440e7a19
2 changed files with 52 additions and 1 deletions

View File

@@ -181,3 +181,43 @@ def label_files(directory, label, *args):
file.seek(0)
file.write(read_files[i])
file.close()
def remove_properties(file, *args):
"""
Remove properties from a file
:param file: file name
:param args: properties to remove
"""
new_content = ""
with open(file, "r+") as read_file:
content = read_file.read()
for line in content.splitlines():
if not any(prop in line for prop in args):
new_content += line + "\n"
elif "}" in line:
new_content += "}\n"
read_file.seek(0)
read_file.write(new_content)
def remove_keywords(file, *args):
"""
Remove keywords from a file
:param file: file name
:param args: keywords to remove
"""
with open(file, "r+") as read_file:
content = read_file.read()
for arg in args:
content = content.replace(arg, "")
read_file.seek(0)
read_file.write(content)