parent
d9590f3f0e
commit
e80df25386
2 changed files with 19 additions and 5 deletions
|
@ -1,5 +1,7 @@
|
||||||
Executes a bash one-liner and returns the combined output.
|
Executes a bash one-liner and returns the combined output.
|
||||||
|
|
||||||
This tool spawns a bash process, combines stdout and stderr into one interleaved stream as they are produced (preserving the order of writes), and captures that stream into a string which is returned.
|
This tool spawns a bash process IN THE SPECIFIED WORKING DIRECTORY, combines stdout and stderr into one interleaved stream as they are produced (preserving the order of writes), and captures that stream into a string which is returned.
|
||||||
|
|
||||||
|
WARNING: **NEVER** use 'cd' commands to navigate to the working directory - this is automatically handled by the 'working_directory' parameter. Only use 'cd' to navigate to subdirectories within the specified working directory.
|
||||||
|
|
||||||
Remember that each invocation of this tool will spawn a new bash process, so you can't rely on any state from previous invocations.
|
Remember that each invocation of this tool will spawn a new bash process, so you can't rely on any state from previous invocations.
|
||||||
|
|
|
@ -204,15 +204,27 @@ impl EditFilesTool {
|
||||||
let diff = buffer
|
let diff = buffer
|
||||||
.read_with(&cx, |buffer, cx| {
|
.read_with(&cx, |buffer, cx| {
|
||||||
let new_text = match action {
|
let new_text = match action {
|
||||||
EditAction::Replace { old, new, .. } => {
|
EditAction::Replace {
|
||||||
|
file_path,
|
||||||
|
old,
|
||||||
|
new,
|
||||||
|
} => {
|
||||||
// TODO: Replace in background?
|
// TODO: Replace in background?
|
||||||
buffer.text().replace(&old, &new)
|
let text = buffer.text();
|
||||||
|
if text.contains(&old) {
|
||||||
|
text.replace(&old, &new)
|
||||||
|
} else {
|
||||||
|
return Err(anyhow!(
|
||||||
|
"Could not find search text in {}",
|
||||||
|
file_path.display()
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EditAction::Write { content, .. } => content,
|
EditAction::Write { content, .. } => content,
|
||||||
};
|
};
|
||||||
|
|
||||||
buffer.diff(new_text, cx)
|
anyhow::Ok(buffer.diff(new_text, cx))
|
||||||
})?
|
})??
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let _clock =
|
let _clock =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue