Add commands

This commit is contained in:
JT
2021-09-03 10:58:15 +12:00
parent 94687a7603
commit 7c8504ea24
23 changed files with 536 additions and 324 deletions

View File

@ -1,6 +1,9 @@
use crate::ast::Call;
use crate::engine::Command;
use crate::engine::EvaluationContext;
use crate::BlockId;
use crate::SyntaxShape;
use crate::Value;
use crate::VarId;
#[derive(Debug, Clone)]
@ -315,7 +318,12 @@ impl Command for Predeclaration {
&self.signature.usage
}
fn run(&self, _args: crate::engine::CommandArgs) -> Result<crate::Value, crate::ShellError> {
fn run(
&self,
_context: &EvaluationContext,
_call: &Call,
_input: Value,
) -> Result<crate::Value, crate::ShellError> {
panic!("Internal error: can't run a predeclaration without a body")
}
}
@ -338,7 +346,12 @@ impl Command for BlockCommand {
&self.signature.usage
}
fn run(&self, _args: crate::engine::CommandArgs) -> Result<crate::Value, crate::ShellError> {
fn run(
&self,
_context: &EvaluationContext,
_call: &Call,
_input: Value,
) -> Result<crate::Value, crate::ShellError> {
panic!("Internal error: can't run custom command with 'run', use block_id");
}