Move eval_hook to nu-cmd-base (#10146)

I moved hook to *nu_cmd_base* instead of *nu_cli* because it will enable
other developers to continue to use hook even if they decide to write
their on cli or NOT depend on nu-cli

Then they will still have the hook functionality because they can
include nu-cmd-base
This commit is contained in:
Michael Angerman 2023-08-29 14:46:50 -07:00 committed by GitHub
parent 7d3312e96e
commit 3f2c76df28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 12 additions and 9 deletions

2
Cargo.lock generated
View file

@ -2647,7 +2647,9 @@ name = "nu-cmd-base"
version = "0.84.1"
dependencies = [
"indexmap 2.0.0",
"miette",
"nu-engine",
"nu-parser",
"nu-path",
"nu-protocol",
]

View file

@ -12,12 +12,12 @@ bench = false
[dev-dependencies]
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.84.1" }
nu-command = { path = "../nu-command", version = "0.84.1" }
nu-test-support = { path = "../nu-test-support", version = "0.84.1" }
rstest = { version = "0.18.1", default-features = false }
[dependencies]
nu-cmd-base = { path = "../nu-cmd-base", version = "0.84.1" }
nu-command = { path = "../nu-command", version = "0.84.1" }
nu-engine = { path = "../nu-engine", version = "0.84.1" }
nu-path = { path = "../nu-path", version = "0.84.1" }
nu-parser = { path = "../nu-parser", version = "0.84.1" }

View file

@ -8,9 +8,9 @@ use crate::{
use crossterm::cursor::SetCursorStyle;
use log::{trace, warn};
use miette::{ErrReport, IntoDiagnostic, Result};
use nu_cmd_base::hook::eval_hook;
use nu_cmd_base::util::get_guaranteed_cwd;
use nu_color_config::StyleComputer;
use nu_command::hook::eval_hook;
use nu_engine::convert_env_values;
use nu_parser::{lex, parse, trim_quotes_str};
use nu_protocol::{
@ -50,7 +50,7 @@ pub fn evaluate_repl(
load_std_lib: Option<Spanned<String>>,
entire_start_time: Instant,
) -> Result<()> {
use nu_command::hook;
use nu_cmd_base::hook;
use reedline::Signal;
let use_color = engine_state.get_config().use_ansi_coloring;

View file

@ -1,4 +1,4 @@
use nu_command::hook::eval_hook;
use nu_cmd_base::hook::eval_hook;
use nu_engine::{eval_block, eval_block_with_early_return};
use nu_parser::{escape_quote_string, lex, parse, unescape_unquote_string, Token, TokenContents};
use nu_protocol::engine::StateWorkingSet;

View file

@ -11,6 +11,8 @@ version = "0.84.1"
[dependencies]
nu-engine = { path = "../nu-engine", version = "0.84.1" }
nu-parser = { path = "../nu-parser", version = "0.84.1" }
nu-path = { path = "../nu-path", version = "0.84.1" }
nu-protocol = { version = "0.84.1", path = "../nu-protocol" }
indexmap = { version = "2.0" }
miette = { version = "5.10", features = ["fancy-no-backtrace"] }

View file

@ -1,5 +1,5 @@
use crate::util::get_guaranteed_cwd;
use miette::Result;
use nu_cmd_base::util::get_guaranteed_cwd;
use nu_engine::{eval_block, eval_block_with_early_return};
use nu_parser::parse;
use nu_protocol::ast::PathMember;

View file

@ -1,3 +1,4 @@
pub mod formats;
pub mod hook;
pub mod input_handler;
pub mod util;

View file

@ -13,7 +13,6 @@ mod formats;
mod generators;
mod hash;
mod help;
pub mod hook;
mod math;
mod misc;
mod network;
@ -44,7 +43,6 @@ pub use formats::*;
pub use generators::*;
pub use hash::*;
pub use help::*;
pub use hook::*;
pub use math::*;
pub use misc::*;
pub use network::*;

View file

@ -1,4 +1,4 @@
use crate::hook::eval_hook;
use nu_cmd_base::hook::eval_hook;
use nu_engine::env_to_strings;
use nu_engine::CallExt;
use nu_protocol::{

View file

@ -1,4 +1,4 @@
use nu_command::hook::{eval_env_change_hook, eval_hook};
use nu_cmd_base::hook::{eval_env_change_hook, eval_hook};
use nu_engine::eval_block;
use nu_parser::parse;
use nu_protocol::engine::{EngineState, Stack, StateWorkingSet};