(&self, py: Python<'_>, path: Option<String>)
| 2072 | /// List a directory in the workspace. |
| 2073 | #[pyo3(signature = (path=None))] |
| 2074 | fn ls(&self, py: Python<'_>, path: Option<String>) -> PyResult<PyToolResult> { |
| 2075 | let session = self.inner.clone(); |
| 2076 | let result = py |
| 2077 | .allow_threads(move || get_runtime().block_on(session.ls(path.as_deref()))) |
| 2078 | .map_err(|e| PyRuntimeError::new_err(format!("{e}")))?; |
| 2079 | |
| 2080 | Ok(PyToolResult { |
| 2081 | name: result.name, |
| 2082 | output: result.output, |
| 2083 | exit_code: result.exit_code, |
| 2084 | metadata_json: result.metadata.as_ref().map(serde_json::Value::to_string), |
| 2085 | error_kind_json: result |
| 2086 | .error_kind |
| 2087 | .as_ref() |
| 2088 | .and_then(|k| serde_json::to_string(k).ok()), |
| 2089 | }) |
| 2090 | } |
| 2091 | |
| 2092 | /// Edit a file by replacing text in the workspace. |
| 2093 | #[pyo3(signature = (path, old_string, new_string, replace_all=false))] |
no test coverage detected