#' Enumerate values
#'
#' Format a vector of values into a string that can be embedded into
#' messages conveyed to the user.
#'
#' @name enum
#'
#' @param x `[any]`
#'
#' An object, typically an [atomic vector][base::atomic()].
#'
#' @returns A `character(1)` equal to `"x[[1]], x[[2]], ... or x[[length(x)]]"`,
#' where `x` elements are replaced by their proper values.
#'
#' @details The actual output must be passed to another [`ui_*()`][dotprofile-ui]
#' or \pkg{cli}'s function in order to be properly rendered. See examples.
#'
#' @examples
#' \dontrun{
#' values <- c("a", "b", "c")
#' dotprofile:::enum(values)
#'
#' ## Render the output.
#' dotprofile::ui_info("{.val {enum(values)}}")
#' cli::cli_text("{.val {enum(values)}}")}
#'
#' @keywords internal
enum <- function(x)
{
return(cli::cli_vec(x, list(vec_sep = ', ', vec_last = ' or ')))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.