This commit is contained in:
MLH
2024-12-12 00:23:34 +01:00
parent 809d4bb50e
commit 86129f2335
2 changed files with 4 additions and 4 deletions

View File

@ -173,7 +173,7 @@ def modifyFiles(config, destinationDirectory):
if after_text not in content: #if not re.search(after_text, content): # for use of * wildcard in text
raise ValueError(f"Text '{after_text}' not found in file: {filePath}")
elif insert_text not in content:
print(f" {Colors.GREEN}Inserting text after: {after_text} + -> {insert_text}{Colors.RESET}")
print(f" {Colors.GREEN}Inserting text after: {after_text} {Colors.YELLOW}+ ->{Colors.GREEN} {insert_text}{Colors.RESET}")
content = content.replace(after_text, after_text + insert_text)
else:
print(f" {Colors.YELLOW}Text already present after: {after_text}{Colors.RESET}")
@ -186,7 +186,7 @@ def modifyFiles(config, destinationDirectory):
if before_text not in content:
raise ValueError(f"Text '{before_text}' not found in file: {filePath}")
elif insert_text not in content:
print(f" {Colors.GREEN}Inserting text before: {insert_text} + <- {before_text}{Colors.RESET}")
print(f" {Colors.GREEN}Inserting text before: {insert_text} {Colors.YELLOW}+ <-{Colors.GREEN} {before_text}{Colors.RESET}")
content = content.replace(before_text, insert_text + before_text)
else:
print(f" {Colors.YELLOW}Text already present before: {before_text}{Colors.RESET}")
@ -199,7 +199,7 @@ def modifyFiles(config, destinationDirectory):
if old_text not in content and new_text not in content:
raise ValueError(f"Text '{old_text}' not found in file: {filePath}")
elif new_text not in content:
print(f" {Colors.GREEN}Replacing text: {old_text} -> {new_text}{Colors.RESET}")
print(f" {Colors.GREEN}Replacing text: {old_text} {Colors.YELLOW}->{Colors.GREEN} {new_text}{Colors.RESET}")
content = content.replace(old_text, new_text)
else:
print(f" {Colors.YELLOW}Text already replaced: {old_text} -> {new_text}{Colors.RESET}")