This commit is contained in:
MLH
2024-12-10 02:30:28 +01:00
parent a198729ba9
commit 5e488d92fe

View File

@ -106,7 +106,7 @@ def copySources(config, destinationDirectory):
# Copy files or directories
if os.path.isdir(sourcePath):
if not os.path.exists(targetPath):
print(f"Copying directory: {sourcePath} -> {targetPath}")
print(f"{Colors.GREEN}Copying directory: {sourcePath} -> {targetPath}{Colors.RESET}")
shutil.copytree(sourcePath, targetPath)
results['copies'] += 1
else:
@ -114,7 +114,7 @@ def copySources(config, destinationDirectory):
errorList['copyWarnings'] += 1
else:
if not os.path.exists(targetPath):
print(f"Copying file: {sourcePath} -> {targetPath}")
print(f"{Colors.GREEN}Copying file: {sourcePath} -> {targetPath}{Colors.RESET}")
shutil.copy2(sourcePath, targetPath)
results['copies'] += 1
else:
@ -171,7 +171,7 @@ def modifyFiles(config, destinationDirectory):
if after_text not in content:
raise ValueError(f"Text '{after_text}' not found in file: {filePath}")
elif insert_text not in content:
print(f" Inserting text after: {after_text}")
print(f" {Colors.GREEN}Inserting text after: {after_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}")
@ -184,7 +184,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" Inserting text before: {before_text}")
print(f" {Colors.GREEN}Inserting text before: {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}")
@ -197,7 +197,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" Replacing text: {old_text} -> {new_text}")
print(f" {Colors.GREEN}Replacing text: {old_text} -> {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}")