| is_dynamic_tty {cli} | R Documentation |
\r (Carriage return)In a terminal, \r moves the cursor to the first position of the
same line. It is also supported by most R IDEs. \r is typically
used to achive a more dynamic, less cluttered user interface, e.g.
to create progress bars.
is_dynamic_tty(stream = stderr())
stream |
The stream to inspect, an R connection object. Note that it defaults to the standard error stream, since informative messages are typically printed there. |
If the output is directed to a file, then \r characters are typically
unwanted. This function detects if \r can be used for the given
stream or not.
The detection mechanism is as follows:
If the cli.dynamic option is set to TRUE, TRUE is returned.
If the cli.dynamic option is set to anything else, FALSE is
returned.
If the R_CLI_DYNAMIC environment variable is not empty and set to
the string "true", "TRUE" or "True", TRUE is returned.
If R_CLI_DYNAMIC is not empty and set to anything else, FALSE is
returned.
If the stream is a terminal, then TRUE is returned.
If the stream is hte standard output or error within RStudio,
the macOS R app, or RKWard IDE, TRUE is returned.
Otherwise FALSE is returned.
Other terminal capabilities: is_ansi_tty
is_dynamic_tty() is_dynamic_tty(stdout())