mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 11:25:41 +02:00
return values now
This commit is contained in:
@ -56,7 +56,19 @@ impl Command for Internal {
|
|||||||
let error_style = config.error_style.into_value(call.head);
|
let error_style = config.error_style.into_value(call.head);
|
||||||
let no_newline = false;
|
let no_newline = false;
|
||||||
let commands: Spanned<String> = call.req(engine_state, stack, 0)?;
|
let commands: Spanned<String> = call.req(engine_state, stack, 0)?;
|
||||||
let _ = evaluate_commands(
|
// let _ = evaluate_commands(
|
||||||
|
// &commands,
|
||||||
|
// &mut engine_state.clone(),
|
||||||
|
// &mut stack.clone(),
|
||||||
|
// input,
|
||||||
|
// EvaluateCommandsOpts {
|
||||||
|
// table_mode: Some(table_mode),
|
||||||
|
// error_style: Some(error_style),
|
||||||
|
// no_newline,
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// Ok(PipelineData::Empty)
|
||||||
|
evaluate_commands(
|
||||||
&commands,
|
&commands,
|
||||||
&mut engine_state.clone(),
|
&mut engine_state.clone(),
|
||||||
&mut stack.clone(),
|
&mut stack.clone(),
|
||||||
@ -66,8 +78,7 @@ impl Command for Internal {
|
|||||||
error_style: Some(error_style),
|
error_style: Some(error_style),
|
||||||
no_newline,
|
no_newline,
|
||||||
},
|
},
|
||||||
);
|
)
|
||||||
Ok(PipelineData::Empty)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +98,7 @@ pub fn evaluate_commands(
|
|||||||
stack: &mut Stack,
|
stack: &mut Stack,
|
||||||
input: PipelineData,
|
input: PipelineData,
|
||||||
opts: EvaluateCommandsOpts,
|
opts: EvaluateCommandsOpts,
|
||||||
) -> Result<(), ShellError> {
|
) -> Result<PipelineData, ShellError> {
|
||||||
let EvaluateCommandsOpts {
|
let EvaluateCommandsOpts {
|
||||||
table_mode,
|
table_mode,
|
||||||
error_style,
|
error_style,
|
||||||
@ -146,22 +157,23 @@ pub fn evaluate_commands(
|
|||||||
engine_state.merge_delta(delta)?;
|
engine_state.merge_delta(delta)?;
|
||||||
|
|
||||||
// Run the block
|
// Run the block
|
||||||
let pipeline = eval_block::<WithoutDebug>(engine_state, stack, &block, input)?;
|
// let pipeline = eval_block::<WithoutDebug>(engine_state, stack, &block, input)?;
|
||||||
|
eval_block::<WithoutDebug>(engine_state, stack, &block, input)
|
||||||
|
|
||||||
if let PipelineData::Value(Value::Error { error, .. }, ..) = pipeline {
|
// if let PipelineData::Value(Value::Error { error, .. }, ..) = pipeline {
|
||||||
return Err(*error);
|
// return Err(*error);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if let Some(t_mode) = table_mode {
|
// if let Some(t_mode) = table_mode {
|
||||||
Arc::make_mut(&mut engine_state.config).table.mode =
|
// Arc::make_mut(&mut engine_state.config).table.mode =
|
||||||
t_mode.coerce_str()?.parse().unwrap_or_default();
|
// t_mode.coerce_str()?.parse().unwrap_or_default();
|
||||||
}
|
// }
|
||||||
|
|
||||||
pipeline.print(engine_state, stack, no_newline, false)?;
|
// pipeline.print(engine_state, stack, no_newline, false)?;
|
||||||
|
|
||||||
info!("evaluate {}:{}:{}", file!(), line!(), column!());
|
// info!("evaluate {}:{}:{}", file!(), line!(), column!());
|
||||||
|
|
||||||
Ok(())
|
// Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Reference in New Issue
Block a user