pub fn prompt_yn<S: AsRef<str>>(&self, msg: S, default: bool) -> io::Result<bool> {
        if default {
            self.print_sameline(
                format!("{} [Y/n] - ", msg.as_ref()).blue(),
                QUESTION_PREFIX_MARKER,
                false,
            );
        } else {
            self.print_sameline(
                format!("{} [y/N] - ", msg.as_ref()).blue(),
                QUESTION_PREFIX_MARKER,
                false,
            );
        }
        let mut user_input = String::new();
        stdout().flush()?;
        stdin().read_line(&mut user_input)?;

        let user_pick = user_input.trim().to_ascii_lowercase();
        if default {
            Ok(&user_pick != "n")
        } else {
            Ok(&user_pick == "y")
        }
    }
/// Displays a yes/no prompt. `msg` will be printed in blue, prefixed by a '?'.
/// Will wait for user input before returning what the user selected.
Displays a yes/no prompt. `msg` will be printed in blue, prefixed by a '?'.
Will wait for user input before returning what the user selected.
Displays a yes / no prompt . ` msg ` will be printed in blue prefixed by a ' ? ' . Will wait for user input before returning what the user selected .
pub fn prompt_yn<S: AsRef<str>>(&self, msg: S, default: bool) -> io::Result<bool> {
        if default {
            self.print_sameline(
                format!("{} [Y/n] - ", msg.as_ref()).blue(),
                QUESTION_PREFIX_MARKER,
                false,
            );
        } else {
            self.print_sameline(
                format!("{} [y/N] - ", msg.as_ref()).blue(),
                QUESTION_PREFIX_MARKER,
                false,
            );
        }
        let mut user_input = String::new();
        stdout().flush()?;
        stdin().read_line(&mut user_input)?;
        let user_pick = user_input.trim().to_ascii_lowercase();
        if default {
            Ok(&user_pick != "n")
        } else {
            Ok(&user_pick == "y")
        }
    }
pub fn prompt_yn < S : AsRef < str > > ( & self , msg : S , default : bool ) -> io :: Result < bool > { if default { self . print_sameline ( format ! ( " " msg as_ref ( ) ) . blue ( ) , QUESTION_PREFIX_MARKER , false , ) ; } else { self . print_sameline ( format ! ( " " msg as_ref ( ) ) . blue ( ) , QUESTION_PREFIX_MARKER , false , ) ; } let mut user_input = String :: new ( ) ; stdout ( ) . flush ( ) ? ; stdin ( ) . read_line ( & mut user_input ) ? ; let user_pick = user_input . trim ( ) . to_ascii_lowercase ( ) ; if default { Ok ( & user_pick != " " ) } else { Ok ( & user_pick == " " ) } }
Displays a yes/no prompt.
Displays a yes / no prompt .
&self
msg
S
default
bool