Perform exact string replacements in an existing file.
edit(
self,
file_path: str,
old_string: str,
new_string: str,
replace_all: bool = False
) -> EditResult| Name | Type | Description |
|---|---|---|
file_path* | str | Absolute path to the file to edit. Must start with '/'. |
old_string* | str | Exact string to search for and replace. Must match exactly including whitespace and indentation. |
new_string* | str | String to replace old_string with. Must be different from old_string. |
replace_all | bool | Default: FalseIf True, replace all occurrences. If False (default), old_string must be unique in the file or the edit fails. |