Learn R Programming

btw (version 1.2.0)

btw_tool_files_replace: Tool: Replace exact strings in a text file

Description

Tool: Replace exact strings in a text file

Usage

btw_tool_files_replace(
  path,
  old_string,
  new_string,
  replace_all = FALSE,
  `_intent` = ""
)

Value

Returns a message confirming the replacement was applied.

Arguments

path

Path to the file to edit. The path must be in the current working directory.

old_string

The exact string to find in the file. Must be unique unless replace_all is TRUE.

new_string

The replacement string. Must differ from old_string.

replace_all

If TRUE, replace all occurrences of old_string. Defaults to FALSE, which requires exactly one occurrence.

_intent

An optional string describing the intent of the tool use. When the tool is used by an LLM, the model will use this argument to explain why it called the tool.

See Also

Other files tools: btw_tool_files_edit(), btw_tool_files_list(), btw_tool_files_read(), btw_tool_files_search(), btw_tool_files_write()