From 6f5f943875039b5b2c577367cc955fb2ee5a4516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Sat, 31 Aug 2024 07:24:03 +0200 Subject: [PATCH] remove unused inquire dependency --- Cargo.lock | 1 - Cargo.toml | 1 - src/config/mod.rs | 9 ++------- src/folder/command/delete.rs | 10 +++++----- src/folder/command/purge.rs | 10 +++++----- 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2244aab..df4056f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1896,7 +1896,6 @@ dependencies = [ "email-lib", "email_address", "erased-serde", - "inquire", "mail-builder", "md5", "mml-lib", diff --git a/Cargo.toml b/Cargo.toml index 32d309b..14376bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,7 +60,6 @@ dirs = "4" email-lib = { version = "=0.25.0", default-features = false, features = ["derive", "thread", "tracing"] } email_address = { version = "0.2", optional = true } erased-serde = "0.3" -inquire = "0.7.4" mail-builder = "0.3" md5 = "0.7" mml-lib = { version = "=1.0.14", default-features = false, features = ["derive"] } diff --git a/src/config/mod.rs b/src/config/mod.rs index 69a1b11..e0d2e24 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -14,7 +14,7 @@ use email::{ folder::config::FolderConfig, message::config::MessageConfig, }; #[cfg(feature = "wizard")] -use pimalaya_tui::print; +use pimalaya_tui::{print, prompt}; use serde::{Deserialize, Serialize}; use serde_toml_merge::merge; use shellexpand_utils::{canonicalize, expand}; @@ -124,12 +124,7 @@ impl TomlConfig { async fn from_wizard(path: &PathBuf) -> Result { print::warn(format!("Cannot find existing configuration at {path:?}.")); - let confirm = inquire::Confirm::new("Would you like to create one with the wizard? ") - .with_default(true) - .prompt_skippable()? - .unwrap_or_default(); - - if !confirm { + if !prompt::bool("Would you like to create one with the wizard? ", true)? { std::process::exit(0); } diff --git a/src/folder/command/delete.rs b/src/folder/command/delete.rs index 97bc2d1..a49fba9 100644 --- a/src/folder/command/delete.rs +++ b/src/folder/command/delete.rs @@ -1,8 +1,9 @@ +use std::process; + use clap::Parser; use color_eyre::Result; use email::{backend::feature::BackendFeatureSource, folder::delete::DeleteFolder}; -use inquire::Confirm; -use std::process; +use pimalaya_tui::prompt; use tracing::info; use crate::{ @@ -29,10 +30,9 @@ impl FolderDeleteCommand { let folder = &self.folder.name; - let confirm = Confirm::new(&format!("Do you really want to delete the folder {folder}? All emails will be definitely deleted.")) - .with_default(false).prompt_skippable()?; + let confirm = format!("Do you really want to delete the folder {folder}? All emails will be definitely deleted."); - if let Some(false) | None = confirm { + if !prompt::bool(confirm, false)? { process::exit(0); }; diff --git a/src/folder/command/purge.rs b/src/folder/command/purge.rs index 568abc0..6519fd2 100644 --- a/src/folder/command/purge.rs +++ b/src/folder/command/purge.rs @@ -1,7 +1,9 @@ +use std::process; + use clap::Parser; use color_eyre::Result; use email::{backend::feature::BackendFeatureSource, folder::purge::PurgeFolder}; -use std::process; +use pimalaya_tui::prompt; use tracing::info; use crate::{ @@ -28,11 +30,9 @@ impl FolderPurgeCommand { let folder = &self.folder.name; - let confirm = inquire::Confirm::new(&format!("Do you really want to purge the folder {folder}? All emails will be definitely deleted.")) - .with_default(false) - .prompt_skippable()?; + let confirm = format!("Do you really want to purge the folder {folder}? All emails will be definitely deleted."); - if let Some(false) | None = confirm { + if !prompt::bool(confirm, false)? { process::exit(0); };