mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
feat: check accessible mode for choises prompt
This commit is contained in:
parent
8b7b25d748
commit
609bddaa18
@ -177,13 +177,25 @@ impl<'a, T: Default> ChoicePrompt<'a, T> {
|
|||||||
|
|
||||||
// Ask the same question to end while no valid answers are given
|
// Ask the same question to end while no valid answers are given
|
||||||
loop {
|
loop {
|
||||||
let choice_prompt = self
|
let choice_prompt = if is_running_in_accessible_mode() {
|
||||||
|
self
|
||||||
.choises
|
.choises
|
||||||
.iter()
|
.iter()
|
||||||
.map(|choise| format!("{}{}{}", choise.color, choise.label, *colors::RESET))
|
.map(|choise| format!("{}{}{}", choise.color, choise.label, *colors::RESET))
|
||||||
.collect::<Vec<_>>()
|
.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("/");
|
.join("/");
|
||||||
|
|
||||||
|
format!("[{}]", choises)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// TODO: use accessible mode
|
// TODO: use accessible mode
|
||||||
eprintln!("{} {}", message, choice_prompt);
|
eprintln!("{} {}", message, choice_prompt);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user