mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
move common tools from nu-command
to nu-cmd-base
(#9455)
related to - https://github.com/nushell/nushell/pull/9404 # Description to support our cratification effort and moving non-1.0 commands outside of the main focus, this PR - creates a new `nu-cmd-base` crate to hold the common structs, traits and functions used by all command-related crates - to start the transition, moves the `input_handler` module from `nu-command` to `nu-cmd-base` # User-Facing Changes ``` $nothing ``` # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - ⚫ `toolkit test` - ⚫ `toolkit test stdlib` # After Submitting ``` $nothing ```
This commit is contained in:
parent
64319ad90f
commit
78697bb8cf
42 changed files with 60 additions and 39 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -2742,6 +2742,13 @@ dependencies = [
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nu-cmd-base"
|
||||||
|
version = "0.81.1"
|
||||||
|
dependencies = [
|
||||||
|
"nu-protocol",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nu-cmd-dataframe"
|
name = "nu-cmd-dataframe"
|
||||||
version = "0.81.1"
|
version = "0.81.1"
|
||||||
|
@ -2840,6 +2847,7 @@ dependencies = [
|
||||||
"native-tls",
|
"native-tls",
|
||||||
"notify",
|
"notify",
|
||||||
"nu-ansi-term",
|
"nu-ansi-term",
|
||||||
|
"nu-cmd-base",
|
||||||
"nu-cmd-lang",
|
"nu-cmd-lang",
|
||||||
"nu-color-config",
|
"nu-color-config",
|
||||||
"nu-engine",
|
"nu-engine",
|
||||||
|
|
|
@ -28,6 +28,7 @@ members = [
|
||||||
"crates/nu-engine",
|
"crates/nu-engine",
|
||||||
"crates/nu-parser",
|
"crates/nu-parser",
|
||||||
"crates/nu-system",
|
"crates/nu-system",
|
||||||
|
"crates/nu-cmd-base",
|
||||||
"crates/nu-cmd-extra",
|
"crates/nu-cmd-extra",
|
||||||
"crates/nu-cmd-lang",
|
"crates/nu-cmd-lang",
|
||||||
"crates/nu-cmd-dataframe",
|
"crates/nu-cmd-dataframe",
|
||||||
|
|
13
crates/nu-cmd-base/Cargo.toml
Normal file
13
crates/nu-cmd-base/Cargo.toml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[package]
|
||||||
|
authors = ["The Nushell Project Developers"]
|
||||||
|
description = "The foundation tools to build Nushell commands."
|
||||||
|
edition = "2021"
|
||||||
|
license = "MIT"
|
||||||
|
name = "nu-cmd-base"
|
||||||
|
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-cmd-base"
|
||||||
|
version = "0.81.1"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
nu-protocol = { version = "0.81.1", path = "../nu-protocol" }
|
1
crates/nu-cmd-base/src/lib.rs
Normal file
1
crates/nu-cmd-base/src/lib.rs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
pub mod input_handler;
|
|
@ -95,6 +95,7 @@ url = "2.2"
|
||||||
uuid = { version = "1.3", features = ["v4"] }
|
uuid = { version = "1.3", features = ["v4"] }
|
||||||
wax = { version = "0.5" }
|
wax = { version = "0.5" }
|
||||||
which = { version = "4.4", optional = true }
|
which = { version = "4.4", optional = true }
|
||||||
|
nu-cmd-base = { version = "0.81.1", path = "../nu-cmd-base" }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
winreg = "0.50"
|
winreg = "0.50"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::ast::CellPath;
|
use nu_protocol::ast::CellPath;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
use crate::{
|
use crate::util;
|
||||||
input_handler::{operate, CmdArgument},
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
util,
|
|
||||||
};
|
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::ast::CellPath;
|
use nu_protocol::ast::CellPath;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::{Call, CellPath};
|
use nu_protocol::ast::{Call, CellPath};
|
||||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CellPathOnlyArgs};
|
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::ast::CellPath;
|
use nu_protocol::ast::CellPath;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CellPathOnlyArgs};
|
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::ast::CellPath;
|
use nu_protocol::ast::CellPath;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::ast::CellPath;
|
use nu_protocol::ast::CellPath;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CellPathOnlyArgs};
|
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CellPathOnlyArgs};
|
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CellPathOnlyArgs};
|
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
|
||||||
use crate::{generate_strftime_list, parse_date_from_string};
|
use crate::{generate_strftime_list, parse_date_from_string};
|
||||||
use chrono::{DateTime, FixedOffset, Local, TimeZone, Utc};
|
use chrono::{DateTime, FixedOffset, Local, TimeZone, Utc};
|
||||||
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::ast::CellPath;
|
use nu_protocol::ast::CellPath;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CellPathOnlyArgs};
|
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CellPathOnlyArgs};
|
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use chrono::{FixedOffset, TimeZone};
|
use chrono::{FixedOffset, TimeZone};
|
||||||
|
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::{Call, CellPath};
|
use nu_protocol::ast::{Call, CellPath};
|
||||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||||
|
|
|
@ -15,7 +15,6 @@ mod generators;
|
||||||
mod hash;
|
mod hash;
|
||||||
mod help;
|
mod help;
|
||||||
pub mod hook;
|
pub mod hook;
|
||||||
mod input_handler;
|
|
||||||
mod math;
|
mod math;
|
||||||
mod misc;
|
mod misc;
|
||||||
mod network;
|
mod network;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CellPathOnlyArgs};
|
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::ast::CellPath;
|
use nu_protocol::ast::CellPath;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CellPathOnlyArgs};
|
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::Call, ast::CellPath, engine::Command, engine::EngineState, engine::Stack, Category,
|
ast::Call, ast::CellPath, engine::Command, engine::EngineState, engine::Stack, Category,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::input_handler::{operate as general_operate, CmdArgument};
|
|
||||||
use base64::{
|
use base64::{
|
||||||
alphabet, engine::general_purpose::NO_PAD, engine::general_purpose::PAD,
|
alphabet, engine::general_purpose::NO_PAD, engine::general_purpose::PAD,
|
||||||
engine::GeneralPurpose, Engine,
|
engine::GeneralPurpose, Engine,
|
||||||
};
|
};
|
||||||
|
use nu_cmd_base::input_handler::{operate as general_operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::{Call, CellPath};
|
use nu_protocol::ast::{Call, CellPath};
|
||||||
use nu_protocol::engine::{EngineState, Stack};
|
use nu_protocol::engine::{EngineState, Stack};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate as general_operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate as general_operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::{Call, CellPath};
|
use nu_protocol::ast::{Call, CellPath};
|
||||||
use nu_protocol::engine::{EngineState, Stack};
|
use nu_protocol::engine::{EngineState, Stack};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::{Call, CellPath};
|
use nu_protocol::ast::{Call, CellPath};
|
||||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||||
|
|
|
@ -22,7 +22,7 @@ pub use upcase::SubCommand as StrUpcase;
|
||||||
|
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
|
|
||||||
use crate::input_handler::{operate as general_operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate as general_operate, CmdArgument};
|
||||||
use nu_protocol::ast::{Call, CellPath};
|
use nu_protocol::ast::{Call, CellPath};
|
||||||
use nu_protocol::engine::{EngineState, Stack};
|
use nu_protocol::engine::{EngineState, Stack};
|
||||||
use nu_protocol::{PipelineData, ShellError, Span, Value};
|
use nu_protocol::{PipelineData, ShellError, Span, Value};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::ast::CellPath;
|
use nu_protocol::ast::CellPath;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::ast::CellPath;
|
use nu_protocol::ast::CellPath;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
|
||||||
use crate::{grapheme_flags, util};
|
use crate::{grapheme_flags, util};
|
||||||
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::grapheme_flags;
|
use crate::grapheme_flags;
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::ast::CellPath;
|
use nu_protocol::ast::CellPath;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
|
||||||
use fancy_regex::{NoExpand, Regex};
|
use fancy_regex::{NoExpand, Regex};
|
||||||
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CellPathOnlyArgs};
|
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::ast::CellPath;
|
use nu_protocol::ast::CellPath;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::ast::CellPath;
|
use nu_protocol::ast::CellPath;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
|
||||||
use crate::{grapheme_flags, util};
|
use crate::{grapheme_flags, util};
|
||||||
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::ast::CellPath;
|
use nu_protocol::ast::CellPath;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::input_handler::{operate, CmdArgument};
|
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ast::{Call, CellPath},
|
ast::{Call, CellPath},
|
||||||
|
|
Loading…
Reference in a new issue