| 299 | } |
| 300 | |
| 301 | function runGrep(p: ToolProps<typeof GrepTool>): ToolInline { |
| 302 | const root = p.input.path ?? "" |
| 303 | const title = `Grep "${p.input.pattern ?? ""}"` |
| 304 | const suffix = root ? `in ${toolPath(root)}` : "" |
| 305 | const matches = p.metadata.matches |
| 306 | const description = matches === undefined ? suffix : `${suffix}${suffix ? " · " : ""}${count(matches, "match")}` |
| 307 | return { |
| 308 | icon: "✱", |
| 309 | title, |
| 310 | ...(description && { description }), |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | function runList(p: ToolProps): ToolInline { |
| 315 | const dir = text(dict(p.input).path) |