..
This commit is contained in:
@ -106,7 +106,7 @@ def copySources(config, destinationDirectory):
|
|||||||
# Copy files or directories
|
# Copy files or directories
|
||||||
if os.path.isdir(sourcePath):
|
if os.path.isdir(sourcePath):
|
||||||
if not os.path.exists(targetPath):
|
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)
|
shutil.copytree(sourcePath, targetPath)
|
||||||
results['copies'] += 1
|
results['copies'] += 1
|
||||||
else:
|
else:
|
||||||
@ -114,7 +114,7 @@ def copySources(config, destinationDirectory):
|
|||||||
errorList['copyWarnings'] += 1
|
errorList['copyWarnings'] += 1
|
||||||
else:
|
else:
|
||||||
if not os.path.exists(targetPath):
|
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)
|
shutil.copy2(sourcePath, targetPath)
|
||||||
results['copies'] += 1
|
results['copies'] += 1
|
||||||
else:
|
else:
|
||||||
@ -171,7 +171,7 @@ def modifyFiles(config, destinationDirectory):
|
|||||||
if after_text not in content:
|
if after_text not in content:
|
||||||
raise ValueError(f"Text '{after_text}' not found in file: {filePath}")
|
raise ValueError(f"Text '{after_text}' not found in file: {filePath}")
|
||||||
elif insert_text not in content:
|
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)
|
content = content.replace(after_text, after_text + insert_text)
|
||||||
else:
|
else:
|
||||||
print(f" {Colors.YELLOW}Text already present after: {after_text}{Colors.RESET}")
|
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:
|
if before_text not in content:
|
||||||
raise ValueError(f"Text '{before_text}' not found in file: {filePath}")
|
raise ValueError(f"Text '{before_text}' not found in file: {filePath}")
|
||||||
elif insert_text not in content:
|
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)
|
content = content.replace(before_text, insert_text + before_text)
|
||||||
else:
|
else:
|
||||||
print(f" {Colors.YELLOW}Text already present before: {before_text}{Colors.RESET}")
|
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:
|
if old_text not in content and new_text not in content:
|
||||||
raise ValueError(f"Text '{old_text}' not found in file: {filePath}")
|
raise ValueError(f"Text '{old_text}' not found in file: {filePath}")
|
||||||
elif new_text not in content:
|
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)
|
content = content.replace(old_text, new_text)
|
||||||
else:
|
else:
|
||||||
print(f" {Colors.YELLOW}Text already replaced: {old_text} -> {new_text}{Colors.RESET}")
|
print(f" {Colors.YELLOW}Text already replaced: {old_text} -> {new_text}{Colors.RESET}")
|
||||||
|
Reference in New Issue
Block a user