The R package messages
is a collection of functions to print messages in the R console using the packages cli
and crayon
. This package is strongly inspired from the functions ui_*()
of the package usethis
.
You can install the development version from GitHub with:
# install.packages("remotes")
remotes::install_github("frbcesab/messages")
## Attach package ----
library("messages")
## Success message ----
msg_done("A success message")
#> ✓ A success message
## Todo message ----
msg_todo("A to do message")
#> • A to do message
## Info message ----
msg_info("An informational message")
#> ℹ An informational message
## Warning message ----
msg_warn("A warning message")
#> ! A warning message
## Error message ----
msg_oops("An error message")
#> x An error message
## Message ----
msg_line("A classic message")
#> A classic message
## Message within a rule ----
msg_rule("Left message")
#> ── Left message ─────────────────────────────────────────────────────────────────────────
## Message within a rule ----
msg_rule(center = "Center message")
#> ───────────────────────────────────── Center message ────────────────────────────────────
## Message within a rule ----
msg_rule(right = "Right message")
#> ──────────────────────────────────────────────────────────────────────── Right message ──
## Messages with inline customization ----
x <- 1
msg_done("The variable", msg_field("x"), "has been set to", msg_value(x))
#> ✓ The variable x has been set to 1
## Messages with inline customization (2) ----
msg_todo("Please use the function:", msg_code("msg_rule()"))
#> • Please use the function: `msg_rule()`
## Messages with inline customization (3) ----
msg_todo("Please use the function:\n", msg_code("msg_rule()"))
#> • Please use the function:
#> `msg_rule()`
Please cite this package as:
Casajus N. (2022) messages: Print messages in the console. R package version 1.0. URL: https://frbcesab.github.io/messages/.
You can also run:
citation("messages")
## A BibTeX entry for LaTeX users is:
##
## @Manual{,
## title = {{messages}: {P}rint messages in the console,
## author = {{Casajus N.}},
## year = {2022},
## note = {R package version 1.0},
## url = {https://frbcesab.github.io/messages/},
## }