mirror of
https://github.com/master-of-zen/Av1an.git
synced 2024-11-24 18:18:06 +00:00
Fix confirmation prompt (#361)
This commit is contained in:
parent
21817fe581
commit
962f880764
1 changed files with 5 additions and 7 deletions
|
@ -181,14 +181,12 @@ fn confirm(prompt: &str) -> io::Result<bool> {
|
|||
stdout.flush()?;
|
||||
stdin.read_line(&mut buf)?;
|
||||
|
||||
match buf.as_str() {
|
||||
"y\n" | "Y\n" => break Ok(true),
|
||||
"n\n" | "N\n" => break Ok(false),
|
||||
match buf.as_str().trim() {
|
||||
// allows enter to continue
|
||||
"y" | "Y" | "" => break Ok(true),
|
||||
"n" | "N" => break Ok(false),
|
||||
other => {
|
||||
println!(
|
||||
"Sorry, response {:?} is not understood.",
|
||||
&other.get(..other.len().saturating_sub(1)).unwrap_or("")
|
||||
);
|
||||
println!("Sorry, response {:?} is not understood.", other);
|
||||
buf.clear();
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue