These functions are used to construct an user interface a la usethis
.
These msg_*
functions can be broken down into two main categories:
block styles: msg_line()
, msg_rule()
, msg_done()
, msg_todo()
,
msg_info()
, msg_warn()
, msg_oops()
.
inline styles: msg_field()
, msg_value()
, msg_code()
.
msg_done(...)
msg_todo(...)
msg_info(...)
msg_warn(...)
msg_oops(...)
msg_line(...)
msg_rule(...)
msg_field(...)
msg_value(...)
msg_code(...)
One or several expression (character or vector object).
Print a success message.
msg_todo
: Print a to do message.
msg_info
: Print an informational message.
msg_warn
: Print a warning message.
msg_oops
: Print an error message.
msg_line
: Print an (non-)empty message.
msg_rule
: Print a rule message.
msg_field
: Returns a customized code expression.
msg_value
: Returns a customized variable value.
msg_code
: Returns a customized code expression.
Messages can be suppressed by using options(messages = FALSE)
.
Messages can be reactivated by using: options(messages = TRUE)
.
## Block messages ----
msg_done("A success message")
#> ✔ A success message
msg_todo("A to do message")
#> • A to do message
msg_info("An informational message")
#> ℹ An informational message
msg_warn("A warning message")
#> ⚠ A warning message
msg_oops("An error message")
#> ✖ An error message
msg_line()
#>
msg_line("A message")
#> A message
msg_rule("Left message")
#> ── Left message ────────────────────────────────────────────────────────────────
msg_rule("Left message", , "Right message")
#> ── Left message ─────────────────────────────────────────────── Right message ──
msg_rule("Left message", right = "Right message")
#> ── Left message ─────────────────────────────────────────────── Right message ──
msg_rule(, "Center message")
#> ──────────────────────────────── Center message ────────────────────────────────
msg_rule(center = "Center message")
#> ──────────────────────────────── Center message ────────────────────────────────
## Inline messages ----
msg_done("The variable", msg_field("x"), "has been set to", msg_value(1))
#> ✔ The variable x has been set to 1
msg_todo("Please use the function:", msg_code("msg_rule()"))
#> • Please use the function: `msg_rule()`
msg_line("Thanks for using", msg_code("messages"))
#> Thanks for using `messages`
msg_line(msg_code("msg_rule()"))
#> `msg_rule()`