Skip to main content

select_one

Function select_one 

Source
pub fn select_one(
    prompt: &str,
    options: &[String],
    is_json: bool,
) -> Result<usize, SelectError>
Expand description

Prompt the user to select one option from a list using dialoguer.

  • is_json: return Err(SelectError::JsonModeNeedsExplicit).
  • Non-TTY: auto-select first option with stderr warning.
  • Interactive: use dialoguer::Select on stderr.