Learn R Programming

aisdk (version 1.1.0)

console_menu: Console Interactive Menu

Description

Present a numbered list of choices and return the user's selection. Styled with cli to match the console chat interface. Similar to utils::menu() but with cli formatting.

Usage

console_menu(title, choices)

Value

The index of the selected choice (integer), or NULL if cancelled (user enters 'q' or empty input).

Arguments

title

The question or prompt to display.

choices

Character vector of options to present.

Examples

Run this code
# \donttest{
if (interactive()) {
  selection <- console_menu("Which database?", c("PostgreSQL", "SQLite", "DuckDB"))
}
# }

Run the code above in your browser using DataLab