Debian Codegraph @

R/utils-format.R

raw
1
2 stopf <- function(fmt = "", ..., call. = FALSE) {
3 stop(sprintf(fmt, ...), call. = call.)
4 }
5
6 warningf <- function(fmt = "", ..., call. = FALSE, immediate. = FALSE) {
7 warning(sprintf(fmt, ...), call. = call., immediate. = immediate.)
8 }
9
10 printf <- function(fmt = "", ..., file = stdout(), sep = "") {
11 if (!is.null(fmt) && renv_verbose())
12 cat(sprintf(fmt, ...), file = file, sep = sep)
13 }
14
15 writef <- function(fmt = "", ..., con = stdout()) {
16 if (!is.null(fmt) && renv_verbose())
17 writeLines(sprintf(fmt, ...), con = con)
18 }
19
20 fyi <- function(fmt = NULL, ...) {
21 prefix <- if (l10n_info()$`UTF-8`) "\u001b[34m\u2139\u001b[0m" else "i"
22 message <- if (length(fmt)) sprintf(fmt, ...)
23 if (length(message)) paste(prefix, message) else prefix
24 }
25
26 yay <- function(fmt = NULL, ...) {
27 prefix <- if (l10n_info()$`UTF-8`) "\u001b[32m\u2714\u001b[0m" else "y"
28 message <- if (length(fmt)) sprintf(fmt, ...)
29 if (length(message)) paste(prefix, message) else prefix
30 }
31
32 boo <- function(fmt = NULL, ...) {
33 prefix <- if (l10n_info()$`UTF-8`) "\u001b[31m\u2716\u001b[0m" else "x"
34 message <- if (length(fmt)) sprintf(fmt, ...)
35 if (length(message)) paste(prefix, message) else prefix
36 }