This commit is contained in:
JT
2021-10-25 19:31:39 +13:00
parent 397a31e69c
commit b5965ee8ef
60 changed files with 502 additions and 455 deletions

View File

@ -1,6 +1,6 @@
use nu_engine::{eval_block, CallExt};
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EvaluationContext};
use nu_protocol::engine::{Command, EngineState, EvaluationContext, Stack};
use nu_protocol::{PipelineData, ShellError, Signature, SyntaxShape, Value};
/// Source a file for environment variables.
@ -26,15 +26,16 @@ impl Command for Source {
fn run(
&self,
context: &EvaluationContext,
engine_state: &EngineState,
stack: &mut Stack,
call: &Call,
input: PipelineData,
) -> Result<PipelineData, ShellError> {
// Note: this hidden positional is the block_id that corresponded to the 0th position
// it is put here by the parser
let block_id: i64 = call.req(context, 1)?;
let block_id: i64 = call.req(engine_state, stack, 1)?;
let block = context.engine_state.get_block(block_id as usize).clone();
eval_block(context, &block, input)
let block = engine_state.get_block(block_id as usize).clone();
eval_block(engine_state, stack, &block, input)
}
}