enum: Enumerate values

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

Format a vector of values into a string that can be embedded into messages conveyed to the user.

Usage

1
enum(x)

Arguments

x

[any]

An object, typically an atomic vector.

Details

The actual output must be passed to another ui_*() or cli's function in order to be properly rendered. See examples.

Value

A character(1) equal to "x[[1]], x[[2]], ... or x[[length(x)]]", where x elements are replaced by their proper values.

Examples

1
2
3
4
5
6
7
8
## Not run: 
  values <- c("a", "b", "c")
  dotprofile:::enum(values)

  ## Render the output.
  dotprofile::ui_info("{.val {enum(values)}}")
  cli::cli_text("{.val {enum(values)}}")
## End(Not run)

jeanmathieupotvin/dotprofile documentation built on Dec. 20, 2021, 10:08 p.m.