mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 14:28:11 +02:00
Add commands
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
use crate::{BlockId, Example, ShellError, Signature, Value};
|
||||
use crate::{ast::Call, BlockId, Example, ShellError, Signature, Value};
|
||||
|
||||
use super::CommandArgs;
|
||||
use super::EvaluationContext;
|
||||
|
||||
pub trait Command {
|
||||
fn name(&self) -> &str;
|
||||
@ -15,19 +15,12 @@ pub trait Command {
|
||||
""
|
||||
}
|
||||
|
||||
fn run(&self, args: CommandArgs) -> Result<Value, ShellError>;
|
||||
|
||||
// fn run(&self, args: CommandArgs) -> Result<InputStream, ShellError> {
|
||||
// let context = args.context.clone();
|
||||
// let stream = self.run_with_actions(args)?;
|
||||
|
||||
// Ok(Box::new(crate::evaluate::internal::InternalIterator {
|
||||
// context,
|
||||
// input: stream,
|
||||
// leftovers: InputStream::empty(),
|
||||
// })
|
||||
// .into_output_stream())
|
||||
// }
|
||||
fn run(
|
||||
&self,
|
||||
context: &EvaluationContext,
|
||||
call: &Call,
|
||||
input: Value,
|
||||
) -> Result<Value, ShellError>;
|
||||
|
||||
fn is_binary(&self) -> bool {
|
||||
false
|
||||
|
@ -1,7 +0,0 @@
|
||||
use super::{EvaluationContext, UnevaluatedCallInfo};
|
||||
|
||||
pub struct CommandArgs {
|
||||
pub context: EvaluationContext,
|
||||
pub call_info: UnevaluatedCallInfo,
|
||||
pub input: crate::Value,
|
||||
}
|
@ -1,11 +1,9 @@
|
||||
mod call_info;
|
||||
mod command;
|
||||
mod command_args;
|
||||
mod engine_state;
|
||||
mod evaluation_context;
|
||||
|
||||
pub use call_info::*;
|
||||
pub use command::*;
|
||||
pub use command_args::*;
|
||||
pub use engine_state::*;
|
||||
pub use evaluation_context::*;
|
||||
|
Reference in New Issue
Block a user