feat: check accessible mode for choises prompt

This commit is contained in:
Talison Fabio 2025-03-22 20:16:01 -03:00
parent 8b7b25d748
commit 609bddaa18

View File

@ -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::<Vec<_>>()
.join("/");
let choice_prompt = if is_running_in_accessible_mode() {
self
.choises
.iter()
.map(|choise| format!("{}{}{}", choise.color, choise.label, *colors::RESET))
.collect::<Vec<_>>()
.join("/")
} else {
let choises = self
.choises
.iter()
.map(|choise| format!("{}{}{}", choise.color, choise.label.chars().nth(0).expect("dev error"), *colors::RESET))
.collect::<Vec<_>>()
.join("/");
format!("[{}]", choises)
};
// TODO: use accessible mode
eprintln!("{} {}", message, choice_prompt);