mirror of
https://github.com/bryangerlach/rdgen.git
synced 2025-11-29 00:23:27 +00:00
1.4.4
This commit is contained in:
7
.github/patches/allowCustom.py
vendored
7
.github/patches/allowCustom.py
vendored
@@ -44,15 +44,10 @@ def remove_line_block(filepath, start_phrase, lines_to_remove_after_start):
|
|||||||
|
|
||||||
# 3. Write the remaining lines back to the file (with backup)
|
# 3. Write the remaining lines back to the file (with backup)
|
||||||
try:
|
try:
|
||||||
# Create a backup just in case
|
|
||||||
backup_filepath = filepath + '.bak'
|
|
||||||
shutil.copyfile(filepath, backup_filepath)
|
|
||||||
|
|
||||||
with open(filepath, 'w') as file:
|
with open(filepath, 'w') as file:
|
||||||
file.writelines(lines_to_keep)
|
file.writelines(lines_to_keep)
|
||||||
|
|
||||||
print(f"✅ Success! Removed the 9-line block starting with '{start_phrase.strip()}' from {filepath}.")
|
print(f"Success! Removed the 9-line block starting with '{start_phrase.strip()}' from {filepath}.")
|
||||||
print(f"A backup of the original file was saved as {backup_filepath}.")
|
|
||||||
|
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
print(f"An error occurred while writing to the file: {e}")
|
print(f"An error occurred while writing to the file: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user