Skip to main content

confirm

Function confirm 

Source
pub fn confirm(
    prompt: &str,
    default_yes: bool,
    skip_prompt: bool,
    is_json: bool,
) -> bool
Expand description

Prompt the user for a yes/no confirmation.

  • skip_prompt (from -y flag) or is_json: return default_yes immediately.
  • Non-TTY stdin: return default_yes with a stderr warning.
  • Interactive: print prompt to stderr, read line; empty = default_yes.