forked from extern/nushell
* lazyframe definition * expressions and lazy frames * new alias expression * more expression commands * updated to polars main * more expressions and groupby * more expressions, fetch and sort-by * csv reader * removed open csv * unique function * joining functions * join lazy frames commands with eager commands * corrected tests * Update .gitignore * Update .gitignore Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
16 lines
500 B
Rust
16 lines
500 B
Rust
use nu_protocol::{FromValue, ShellError, Value};
|
|
|
|
pub fn extract_strings(value: Value) -> Result<Vec<String>, ShellError> {
|
|
match (
|
|
<String as FromValue>::from_value(&value),
|
|
<Vec<String> as FromValue>::from_value(&value),
|
|
) {
|
|
(Ok(col), Err(_)) => Ok(vec![col]),
|
|
(Err(_), Ok(cols)) => Ok(cols),
|
|
_ => Err(ShellError::IncompatibleParametersSingle(
|
|
"Expected a string or list of strings".into(),
|
|
value.span()?,
|
|
)),
|
|
}
|
|
}
|