cli_qty_lgl: cli pluralization helpers for booleans

cli_qty_lglR Documentation

cli pluralization helpers for booleans

Description

Equivalents to cli::qty() and cli::no() for a logical input.

Usage

cli_qty_lgl(cnd)

cli_no_lgl(cnd)

Arguments

cnd

Condition. A logical scalar.

Details

If cnd evaluates to TRUE, the resulting cli quantity is 1, otherwise 0. See cli's pluralization rules for details about how these quantities are interpreted.

Value

0L or 1L with the additional class cli_noprint.

See Also

Other functions extending the cli package: cli_process_expr(), cli_progress_step_quick()

Examples

cnd <- runif(1L) < 0.5

cli::pluralize(paste0(
  "{pal::cli_qty_lgl(cnd)}I think this function ",
  "{?comes in handy/is not worth a second of my attention}. Having looked at the rest of the ",
  "package, this {?is quite surprising/does not come as a surprise}."
))

cli::pluralize("This function is worth exactly {pal::cli_no_lgl(cnd)} second of my time.")

salim-b/pal documentation built on Feb. 28, 2025, 6:51 p.m.