Write Cassidy code to file and show explanation in console
Source:R/chat-helpers.R
cassidy_write_code.RdExtracts code blocks from a Cassidy response and writes them to a file, while displaying the explanatory text (non-code parts) in the console. This allows you to see what was done while the actual code is saved to disk.
Usage
cassidy_write_code(
x,
path,
open = interactive(),
append = FALSE,
show_explanation = TRUE
)See also
Other chat-functions:
cassidy_chat(),
cassidy_continue(),
cassidy_session(),
cassidy_write_file(),
chat(),
chat_text()
Examples
if (FALSE) { # \dontrun{
# Ask Cassidy to write code
result <- cassidy_chat(
"Write the cassidy_app() function with UI and server logic",
context = ctx
)
# Code goes to file, explanation to console
cassidy_write_code(result, "R/chat-ui.R")
# Quiet mode - no explanation shown
cassidy_write_code(result, "R/chat-ui.R", show_explanation = FALSE)
} # }