mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 07:00:37 +02:00
Add a config variable with engine support (#332)
* Add a config variable with engine support * Add a config variable with engine support * Oops, cleanup
This commit is contained in:
@ -429,7 +429,9 @@ pub fn eval_subexpression(
|
||||
// to be used later
|
||||
// FIXME: the trimming of the end probably needs to live in a better place
|
||||
|
||||
let mut s = input.collect_string("");
|
||||
let config = stack.get_config()?;
|
||||
|
||||
let mut s = input.collect_string("", &config);
|
||||
if s.ends_with('\n') {
|
||||
s.pop();
|
||||
}
|
||||
|
@ -95,14 +95,32 @@ impl FromValue for f64 {
|
||||
impl FromValue for String {
|
||||
fn from_value(v: &Value) -> Result<Self, ShellError> {
|
||||
// FIXME: we may want to fail a little nicer here
|
||||
Ok(v.clone().into_string(", "))
|
||||
match v {
|
||||
Value::CellPath { val, .. } => Ok(val.into_string()),
|
||||
Value::String { val, .. } => Ok(val.clone()),
|
||||
v => Err(ShellError::CantConvert(
|
||||
"string".into(),
|
||||
v.get_type().to_string(),
|
||||
v.span()?,
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromValue for Spanned<String> {
|
||||
fn from_value(v: &Value) -> Result<Self, ShellError> {
|
||||
Ok(Spanned {
|
||||
item: v.clone().into_string(", "),
|
||||
item: match v {
|
||||
Value::CellPath { val, .. } => val.into_string(),
|
||||
Value::String { val, .. } => val.clone(),
|
||||
v => {
|
||||
return Err(ShellError::CantConvert(
|
||||
"string".into(),
|
||||
v.get_type().to_string(),
|
||||
v.span()?,
|
||||
))
|
||||
}
|
||||
},
|
||||
span: v.span()?,
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user