Struct dialoguer::Confirmation [] [src]

pub struct Confirmation { /* fields omitted */ }

Renders a simple confirmation prompt.

Example usage

use dialoguer::Confirmation;

if Confirmation::new("Do you want to continue?").interact()? {
    println!("Looks like you want to continue");
} else {
    println!("nevermind then :(");
}

Methods

impl Confirmation
[src]

Creates the prompt with a specific text.

Enables or disables the line input mode.

The default is to read a single character and to continue the moment the key was pressed. In the line input mode multiple inputs are allowed and the return key confirms the selection. In that case if the input is incorrect the prompt is rendered again.

Sets the clear behavior of the prompt.

The default is to clear the prompt if line input is disabled and to clear otherwise.

Overrides the default.

Disables or enables the default value display.

The default is to append [y/n] to the prompt to tell the user which keys to press. This also renders the default choice in uppercase. The default is selected on enter.

Enables user interaction and returns the result.

If the user confirms the result is true, false otherwise. The dialog is rendered on stderr.

Like interact but allows a specific terminal to be set.