Skip to main content

Module prompt

Module prompt 

Source

Constants§

CANCELLED
Error message used for a user cancellation (Esc, Ctrl+C, declining a confirmation).
EXIT_CANCELLED
Exit status for a cancelled operation (same convention as SIGINT).

Functions§

cancelled
Report a cancellation and return the error that makes the process exit 130.
confirm
Ask a yes/no question; y/yes (any case) confirms. With assume_yes the question is answered automatically (for --yes).
exit_code_for_error
Process exit code for a top-level error (130 = cancelled, 1 = failure).
is_cancelled
prompt_for_input
prompt_for_missing_arg
prompt_with_default
Prompts with a suggested default (dimmed). Enter keeps default; Esc cancels.
read_line_allow_esc
Read one line with live echo. Esc (or Ctrl+C) returns Ok(None).
read_prompted_line
Prompt shown already printed by caller; reads a line or cancels.
read_prompted_line_raw
Like read_prompted_line but keeps leading/trailing whitespace.