Description Usage Arguments Value Examples
Read a line from the terminal
1 2 |
prompt |
A string that is printed at the beginning of the
line of the user input. Ideally it should be short, so there
is enough space for the input. It can be colored and styled
with ANSI escape sequences from the |
multiline |
Whether to use multi-line mode. This is ignored on unsupported terminals, those work similarly to multi-line mode, anyway. |
history |
If not |
completions |
A character vector of possible TAB-completions.
Ignored on unsupported terminals that use the |
A character scalar, the string that was read.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
read_line(prompt = "what> ")
## History files
hist <- tempfile()
cat("previous entry\n", file = hist, append = TRUE)
cat("another entry\n", file = hist, append = TRUE)
read_line(prompt = "what> ", history = hist)
## The new entry is added to the history file
readLines(hist)
## TAB-completion
read_line(prompt = "what> ", completions = c("foobar", "foo", "bar"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.