Search text files under a directory and return matching lines.
Usage
tool_grep_files(
pattern,
path = ".",
recursive = TRUE,
ignore_case = FALSE,
max_matches = 100
)Format
A tool definition created with ellmer::tool().
Examples
directory <- tempfile()
dir.create(directory)
writeLines("needle", file.path(directory, "example.txt"))
tool_grep_files("needle", directory)
#> [1] "Pattern: needle\nMatches: 1\n\nexample.txt:1: needle"
unlink(directory, recursive = TRUE)