include_file: Read and include files in a prompt

View source: R/include_file.R

include_fileR Documentation

Read and include files in a prompt

Description

Read and include files in a prompt

Usage

include_file(prompt, anyFile)

Arguments

prompt

A vector of strings.

anyFile

A boolean of the same length of prompt indicating that an instruction "ff:" has been detected in a string.

Details

If anyFile[i] is TRUE then the sequence of characters following the instruction "ff:" in prompt[i] is read until the next space or the end of the string. This extracted string is assumed to be a file name. This file is looked for in the current working directory or any of its sub-directories. Once detected, the file is read with readLines() and this content is inserted in prompt between prompt[i-1] and prompt[i+1]. Note that prompt[i] is therefore deleted.

The result is returned.

Value

A vector of strings containing prompt augmented by the files refered to in the original prompt.


codestral documentation built on June 8, 2025, 10:53 a.m.