From 8a8e44abe7b8f7b99789128ed0c07879dd8088ca Mon Sep 17 00:00:00 2001 From: Talison Fabio <54823205+talis-fb@users.noreply.github.com> Date: Tue, 18 Mar 2025 17:41:39 -0300 Subject: [PATCH] feat: use ChoicePrompt in user_wants_to_continue method --- src/utils/question.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/utils/question.rs b/src/utils/question.rs index e9c5829..223593e 100644 --- a/src/utils/question.rs +++ b/src/utils/question.rs @@ -78,18 +78,25 @@ pub fn user_wants_to_continue( QuestionPolicy::AlwaysYes => Ok(true), QuestionPolicy::AlwaysNo => Ok(false), QuestionPolicy::Ask => { + let path = path_to_str(strip_cur_dir(path)); let action = match question_action { QuestionAction::Compression => "compress", QuestionAction::Decompression => "decompress", }; - let path = path_to_str(strip_cur_dir(path)); - let path = Some(&*path); - let placeholder = Some("FILE"); - Confirmation::new(&format!("Do you want to {action} 'FILE'?"), placeholder).ask(path) + + ChoicePrompt::new( + format!("Do you want to {action} {path}?"), + [ + ("yes", true, *colors::GREEN), + ("no", false, *colors::RED), + ], + ) + .ask() } } } + /// Choise dialog for end user with [option1/option2/...] question. /// /// If the placeholder is found in the prompt text, it will be replaced to form the final message.