mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 04:58:42 +00:00
Rm unused fn helpers::confirm::confirm
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
47ed7ce27b
commit
b2bf065a2b
2 changed files with 1 additions and 19 deletions
|
@ -20,7 +20,7 @@ mod auto_abort_join_handle;
|
|||
pub use auto_abort_join_handle::AutoAbortJoinHandle;
|
||||
|
||||
mod confirm;
|
||||
pub use confirm::{confirm, Confirmer};
|
||||
pub use confirm::Confirmer;
|
||||
|
||||
mod extracter;
|
||||
mod readable_rx;
|
||||
|
|
|
@ -1,28 +1,10 @@
|
|||
use std::io::{self, BufRead, Write};
|
||||
|
||||
use log::info;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::task::spawn_blocking;
|
||||
|
||||
use crate::BinstallError;
|
||||
|
||||
pub fn confirm() -> Result<(), BinstallError> {
|
||||
loop {
|
||||
info!("Do you wish to continue? yes/[no]");
|
||||
eprint!("? ");
|
||||
io::stderr().flush().ok();
|
||||
|
||||
let mut input = String::new();
|
||||
io::stdin().read_line(&mut input).unwrap();
|
||||
|
||||
match input.as_str().trim() {
|
||||
"yes" | "y" | "YES" | "Y" => break Ok(()),
|
||||
"no" | "n" | "NO" | "N" | "" => break Err(BinstallError::UserAbort),
|
||||
_ => continue,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct ConfirmerInner {
|
||||
/// Request for confirmation
|
||||
|
|
Loading…
Add table
Reference in a new issue