forked from extern/nushell
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:
@ -49,10 +49,13 @@ impl Command for BuildString {
|
||||
call: &Call,
|
||||
_input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, nu_protocol::ShellError> {
|
||||
let config = stack.get_config()?;
|
||||
let output = call
|
||||
.positional
|
||||
.iter()
|
||||
.map(|expr| eval_expression(engine_state, stack, expr).map(|val| val.into_string(", ")))
|
||||
.map(|expr| {
|
||||
eval_expression(engine_state, stack, expr).map(|val| val.into_string(", ", &config))
|
||||
})
|
||||
.collect::<Result<Vec<String>, ShellError>>()?;
|
||||
|
||||
Ok(Value::String {
|
||||
|
@ -34,12 +34,14 @@ impl Command for StrCollect {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let separator: Option<String> = call.opt(engine_state, stack, 0)?;
|
||||
|
||||
let config = stack.get_config()?;
|
||||
|
||||
// Hmm, not sure what we actually want. If you don't use debug_string, Date comes out as human readable
|
||||
// which feels funny
|
||||
#[allow(clippy::needless_collect)]
|
||||
let strings: Vec<String> = input
|
||||
.into_iter()
|
||||
.map(|value| value.debug_string("\n"))
|
||||
.map(|value| value.debug_string("\n", &config))
|
||||
.collect();
|
||||
|
||||
let output = if let Some(separator) = separator {
|
||||
|
Reference in New Issue
Block a user