From 609bddaa18b8877f563e3a58dd47899ca0a40248 Mon Sep 17 00:00:00 2001 From: Talison Fabio <54823205+talis-fb@users.noreply.github.com> Date: Sat, 22 Mar 2025 20:16:01 -0300 Subject: [PATCH] feat: check accessible mode for choises prompt --- src/utils/question.rs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/utils/question.rs b/src/utils/question.rs index 210e329..fab39a6 100644 --- a/src/utils/question.rs +++ b/src/utils/question.rs @@ -177,12 +177,24 @@ impl<'a, T: Default> ChoicePrompt<'a, T> { // Ask the same question to end while no valid answers are given loop { - let choice_prompt = self - .choises - .iter() - .map(|choise| format!("{}{}{}", choise.color, choise.label, *colors::RESET)) - .collect::>() - .join("/"); + let choice_prompt = if is_running_in_accessible_mode() { + self + .choises + .iter() + .map(|choise| format!("{}{}{}", choise.color, choise.label, *colors::RESET)) + .collect::>() + .join("/") + } else { + let choises = self + .choises + .iter() + .map(|choise| format!("{}{}{}", choise.color, choise.label.chars().nth(0).expect("dev error"), *colors::RESET)) + .collect::>() + .join("/"); + + format!("[{}]", choises) + }; + // TODO: use accessible mode eprintln!("{} {}", message, choice_prompt);