diff options
Diffstat (limited to 'crates/shirabe/src/io/console_io.rs')
| -rw-r--r-- | crates/shirabe/src/io/console_io.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/shirabe/src/io/console_io.rs b/crates/shirabe/src/io/console_io.rs index fe796d9e..911e7242 100644 --- a/crates/shirabe/src/io/console_io.rs +++ b/crates/shirabe/src/io/console_io.rs @@ -538,13 +538,12 @@ impl IOInterfaceImmutable for ConsoleIO { fn select( &self, question: String, - choices: Vec<String>, + choices: PhpMixed, default: PhpMixed, attempts: PhpMixed, error_message: String, multiselect: bool, ) -> PhpMixed { - let choices: PhpMixed = PhpMixed::List(choices.into_iter().map(PhpMixed::String).collect()); let sanitized_question = Self::sanitize(PhpMixed::String(question), true) .as_string() .unwrap_or("") @@ -604,6 +603,10 @@ impl IOInterfaceImmutable for ConsoleIO { .enumerate() .filter_map(|(i, v)| v.as_string().map(|s| (i.to_string(), s.to_string()))) .collect(), + PhpMixed::Array(a) => a + .iter() + .filter_map(|(k, v)| v.as_string().map(|s| (k.clone(), s.to_string()))) + .collect(), _ => IndexMap::new(), }; return PhpMixed::String(array_search(&result_str, &haystack).unwrap_or_default()); |
