(path: str, old_text: str, new_text: str)
| 108 | return f"Error: {e}" |
| 109 | |
| 110 | def run_edit(path: str, old_text: str, new_text: str) -> str: |
| 111 | try: |
| 112 | fp = safe_path(path) |
| 113 | c = fp.read_text() |
| 114 | if old_text not in c: |
| 115 | return f"Error: Text not found in {path}" |
| 116 | fp.write_text(c.replace(old_text, new_text, 1)) |
| 117 | return f"Edited {path}" |
| 118 | except Exception as e: |
| 119 | return f"Error: {e}" |
| 120 | |
| 121 | |
| 122 | # === SECTION: todos (s03) === |
no test coverage detected