local_use_cli | R Documentation |
local_use_cli()
marks a package namespace or the environment of a
running function with a special flag that instructs abort()
to
use cli to format error messages. This formatting happens lazily,
at print-time, in various places:
When an unexpected error is displayed to the user.
When a captured error is printed in the console, for instance via
last_error()
.
When conditionMessage()
is called.
cli formats messages and bullets with indentation and width-wrapping to produce a polished display of messages.
local_use_cli(..., format = TRUE, inline = FALSE, frame = caller_env())
To use cli formatting automatically in your package:
Make sure run_on_load()
is called from your .onLoad()
hook.
Call on_load(local_use_cli())
at the top level of your namespace.
It is also possible to call local_use_cli()
inside a running
function, in which case the flag only applies within that function.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.