mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
Yes/NO defaults to "no" when just enter is pressed (#1948)
* yes/NO in interface * Implement No as default (when only Enter is pressed) * Update README.md Mark the default as [yes] Signed-off-by: pepa65 <pepa65@passchier.net> * Update ui.rs Mark the default as [yes] Signed-off-by: pepa65 <pepa65@passchier.net> * Update ui.rs Do not break on yes/y/YES/Y/"", break on no/n/NO/N, and keep asking otherwise Signed-off-by: pepa65 <pepa65@passchier.net> * Update ui.rs After testing empty didn't work correctly Signed-off-by: pepa65 <pepa65@passchier.net> --------- Signed-off-by: pepa65 <pepa65@passchier.net>
This commit is contained in:
parent
e704abe7ac
commit
81a8218794
2 changed files with 4 additions and 4 deletions
|
@ -10,7 +10,7 @@ fn ask_for_confirm(stdin: &mut StdinLock, input: &mut String) -> io::Result<()>
|
|||
{
|
||||
let mut stdout = io::stdout().lock();
|
||||
|
||||
write!(&mut stdout, "Do you wish to continue? yes/[no]\n? ")?;
|
||||
write!(&mut stdout, "Do you wish to continue? [yes]/no\n? ")?;
|
||||
stdout.flush()?;
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,8 @@ pub async fn confirm() -> Result<(), BinstallError> {
|
|||
}
|
||||
|
||||
match input.as_str().trim() {
|
||||
"yes" | "y" | "YES" | "Y" => break true,
|
||||
"no" | "n" | "NO" | "N" | "" => break false,
|
||||
"yes" | "y" | "YES" | "Y" | "" => break true,
|
||||
"no" | "n" | "NO" | "N" => break false,
|
||||
_ => {
|
||||
input.clear();
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue