This function is inspired by (if not mostly copied from)
usethis::ui_yeah
function. It's purpose is to ask user a yes/no question.
The differences are:
It is more limited in answer options customization. This is done on purpose to standardize command line dialogues in our code.
It uses cli
package under the hood, so cli
rich text formatting is
possible.
cli_yeah(x, straight = FALSE, .envir = parent.frame())
(logical) Returns TRUE
when the user selects a "yes" option and
FALSE
otherwise, i.e. when user selects a "no" option or refuses to make
a selection (cancels).
Question to display.
(logical) Ask a straight Yes/No question? By default (when
FALSE
), two different "no" options and one "yes" option are sampled from
a pool of variants. In other words it behaves just like usethis::ui_yeah
with default parameter setup. When straight = TRUE
, it only shows "Yes"
and "No", literally.
Environment to evaluate the glue expressions in.