nu_cli refactor in preparation for a crate called nu_command (#2907)

* move basic_shell_manager to nu-engine

* move basic_evaluation_context to nu-engine

* fix failing test in feature which commands/classified/external.rs
This commit is contained in:
Michael Angerman
2021-01-10 20:58:15 -08:00
committed by GitHub
parent 231a445809
commit 481c6d4511
13 changed files with 60 additions and 40 deletions

View File

@ -538,10 +538,11 @@ mod tests {
#[cfg(feature = "which")]
use futures::executor::block_on;
#[cfg(feature = "which")]
use nu_engine::basic_evaluation_context;
#[cfg(feature = "which")]
use nu_errors::ShellError;
#[cfg(feature = "which")]
use nu_test_support::commands::ExternalBuilder;
// async fn read(mut stream: OutputStream) -> Option<Value> {
// match stream.try_next().await {
// Ok(val) => {
@ -561,8 +562,8 @@ mod tests {
let cmd = ExternalBuilder::for_name("i_dont_exist.exe").build();
let input = InputStream::empty();
let mut ctx = crate::cli::basic_evaluation_context()
.expect("There was a problem creating a basic context.");
let mut ctx =
basic_evaluation_context().expect("There was a problem creating a basic context.");
assert!(
run_external_command(cmd, &mut ctx, input, ExternalRedirection::Stdout)

View File

@ -1,9 +1,10 @@
use crate::prelude::*;
use nu_engine::basic_evaluation_context;
use nu_engine::whole_stream_command;
use std::error::Error;
pub fn create_default_context(interactive: bool) -> Result<EvaluationContext, Box<dyn Error>> {
let context = crate::cli::basic_evaluation_context()?;
let context = basic_evaluation_context()?;
{
use crate::commands::*;