cli_yeah: User Interface: Ask a Yes/No question

View source: R/cli.R

cli_yeahR Documentation

User Interface: Ask a Yes/No question

Description

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:

  1. It is more limited in answer options customization. This is done on purpose to standardize command line dialogues in our code.

  2. It uses cli package under the hood, so cli rich text formatting is possible.

Usage

cli_yeah(x, straight = FALSE, .envir = parent.frame())

Arguments

x

Question to display.

straight

(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.

.envir

Environment to evaluate the glue expressions in.

Value

(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).


cloudfs documentation built on May 29, 2024, 11:08 a.m.