mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 11:55:55 +02:00
WIP
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
use nu_engine::{eval_block, CallExt};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EvaluationContext};
|
||||
use nu_protocol::{ShellError, Signature, SyntaxShape, Value};
|
||||
use nu_protocol::{PipelineData, ShellError, Signature, SyntaxShape, Value};
|
||||
|
||||
/// Source a file for environment variables.
|
||||
#[derive(Clone)]
|
||||
pub struct Source;
|
||||
|
||||
impl Command for Source {
|
||||
@ -27,17 +28,13 @@ impl Command for Source {
|
||||
&self,
|
||||
context: &EvaluationContext,
|
||||
call: &Call,
|
||||
input: Value,
|
||||
) -> Result<Value, ShellError> {
|
||||
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 = context
|
||||
.engine_state
|
||||
.borrow()
|
||||
.get_block(block_id as usize)
|
||||
.clone();
|
||||
let block = context.engine_state.get_block(block_id as usize).clone();
|
||||
eval_block(context, &block, input)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user