cratification: move the bytes command to nu-cmd-extra (#9509)

now that #9455 has landed we can move the bytes command to nu-cmd-extra

in concert with

moving nu_command::util to nu-cmd-base
This commit is contained in:
Michael Angerman 2023-06-23 12:23:08 -07:00 committed by GitHub
parent 81abb17b38
commit d1449c4ee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 59 additions and 31 deletions

6
Cargo.lock generated
View File

@ -2671,6 +2671,7 @@ dependencies = [
"nix",
"nu-ansi-term",
"nu-cli",
"nu-cmd-base",
"nu-cmd-dataframe",
"nu-cmd-extra",
"nu-cmd-lang",
@ -2725,6 +2726,7 @@ dependencies = [
"log",
"miette",
"nu-ansi-term",
"nu-cmd-base",
"nu-cmd-lang",
"nu-color-config",
"nu-command",
@ -2746,6 +2748,8 @@ dependencies = [
name = "nu-cmd-base"
version = "0.81.1"
dependencies = [
"nu-engine",
"nu-path",
"nu-protocol",
]
@ -2771,11 +2775,13 @@ dependencies = [
name = "nu-cmd-extra"
version = "0.81.1"
dependencies = [
"nu-cmd-base",
"nu-cmd-lang",
"nu-engine",
"nu-parser",
"nu-protocol",
"nu-test-support",
"nu-utils",
"num-traits",
]

View File

@ -48,6 +48,7 @@ members = [
[dependencies]
nu-cli = { path = "./crates/nu-cli", version = "0.81.1" }
nu-color-config = { path = "./crates/nu-color-config", version = "0.81.1" }
nu-cmd-base = { path = "./crates/nu-cmd-base", version = "0.81.1" }
nu-cmd-lang = { path = "./crates/nu-cmd-lang", version = "0.81.1" }
nu-cmd-dataframe = { path = "./crates/nu-cmd-dataframe", version = "0.81.1", optional = true }
nu-cmd-extra = { path = "./crates/nu-cmd-extra", version = "0.81.1", optional = true }

View File

@ -16,6 +16,7 @@ nu-test-support = { path = "../nu-test-support", version = "0.81.1" }
rstest = { version = "0.17.0", default-features = false }
[dependencies]
nu-cmd-base = { path = "../nu-cmd-base", version = "0.81.1" }
nu-command = { path = "../nu-command", version = "0.81.1" }
nu-engine = { path = "../nu-engine", version = "0.81.1" }
nu-path = { path = "../nu-path", version = "0.81.1" }

View File

@ -20,7 +20,7 @@ pub use config_files::eval_config_contents;
pub use eval_cmds::evaluate_commands;
pub use eval_file::evaluate_file;
pub use menus::{DescriptionMenu, NuHelpCompleter};
pub use nu_command::util::get_init_cwd;
pub use nu_cmd_base::util::get_init_cwd;
pub use nu_highlight::NuHighlight;
pub use print::Print;
pub use prompt::NushellPrompt;

View File

@ -8,9 +8,9 @@ use crate::{
use crossterm::cursor::SetCursorStyle;
use log::{trace, warn};
use miette::{IntoDiagnostic, Result};
use nu_cmd_base::util::get_guaranteed_cwd;
use nu_color_config::StyleComputer;
use nu_command::hook::eval_hook;
use nu_command::util::get_guaranteed_cwd;
use nu_engine::convert_env_values;
use nu_parser::{lex, parse, trim_quotes_str};
use nu_protocol::{

View File

@ -10,4 +10,6 @@ version = "0.81.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
nu-engine = { path = "../nu-engine", version = "0.81.1" }
nu-path = { path = "../nu-path", version = "0.81.1" }
nu-protocol = { version = "0.81.1", path = "../nu-protocol" }

View File

@ -1 +1,2 @@
pub mod input_handler;
pub mod util;

View File

@ -16,6 +16,8 @@ bench = false
nu-engine = { path = "../nu-engine", version = "0.81.1" }
nu-parser = { path = "../nu-parser", version = "0.81.1" }
nu-protocol = { path = "../nu-protocol", version = "0.81.1" }
nu-cmd-base = { path = "../nu-cmd-base", version = "0.81.1" }
nu-utils = { path = "../nu-utils", version = "0.81.1" }
# Potential dependencies for extras
num-traits = "0.2"

View File

@ -1,5 +1,5 @@
use crate::util;
use nu_cmd_base::input_handler::{operate, CmdArgument};
use nu_cmd_base::util;
use nu_engine::CallExt;
use nu_protocol::{
ast::{Call, CellPath},

View File

@ -1,4 +1,18 @@
mod bits;
mod bytes;
pub use bytes::Bytes;
pub use bytes::BytesAdd;
pub use bytes::BytesAt;
pub use bytes::BytesBuild;
pub use bytes::BytesCollect;
pub use bytes::BytesEndsWith;
pub use bytes::BytesIndexOf;
pub use bytes::BytesLen;
pub use bytes::BytesRemove;
pub use bytes::BytesReplace;
pub use bytes::BytesReverse;
pub use bytes::BytesStartsWith;
use nu_protocol::engine::{EngineState, StateWorkingSet};
@ -15,7 +29,7 @@ pub fn add_extra_command_context(mut engine_state: EngineState) -> EngineState {
};
}
bind_command!(
bind_command! {
bits::bits_::Bits,
bits::and::BitsAnd,
bits::not::BitsNot,
@ -25,7 +39,24 @@ pub fn add_extra_command_context(mut engine_state: EngineState) -> EngineState {
bits::rotate_right::BitsRor,
bits::shift_left::BitsShl,
bits::shift_right::BitsShr
);
}
// Bytes
bind_command! {
Bytes,
BytesLen,
BytesStartsWith,
BytesEndsWith,
BytesReverse,
BytesReplace,
BytesAdd,
BytesAt,
BytesIndexOf,
BytesCollect,
BytesRemove,
BytesBuild
}
working_set.render()
};

View File

@ -0,0 +1,2 @@
#[cfg(feature = "extra")]
mod bytes;

View File

@ -0,0 +1 @@
mod commands;

View File

@ -13,6 +13,7 @@ version = "0.81.1"
bench = false
[dependencies]
nu-cmd-base = { path = "../nu-cmd-base", version = "0.81.1" }
nu-color-config = { path = "../nu-color-config", version = "0.81.1" }
nu-engine = { path = "../nu-engine", version = "0.81.1" }
nu-glob = { path = "../nu-glob", version = "0.81.1" }
@ -95,7 +96,6 @@ url = "2.2"
uuid = { version = "1.3", features = ["v4"] }
wax = { version = "0.5" }
which = { version = "4.4", optional = true }
nu-cmd-base = { version = "0.81.1", path = "../nu-cmd-base" }
[target.'cfg(windows)'.dependencies]
winreg = "0.50"

View File

@ -211,22 +211,6 @@ pub fn add_shell_command_context(mut engine_state: EngineState) -> EngineState {
StrUpcase
};
// Bytes
bind_command! {
Bytes,
BytesLen,
BytesStartsWith,
BytesEndsWith,
BytesReverse,
BytesReplace,
BytesAdd,
BytesAt,
BytesIndexOf,
BytesCollect,
BytesRemove,
BytesBuild,
}
// FileSystem
bind_command! {
Cd,

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,4 +1,3 @@
mod bytes;
mod charting;
mod conversions;
mod date;
@ -26,10 +25,8 @@ mod shells;
mod sort_utils;
mod strings;
mod system;
pub mod util;
mod viewers;
pub use bytes::*;
pub use charting::*;
pub use conversions::*;
pub use date::*;
@ -57,7 +54,6 @@ pub use shells::*;
pub use sort_utils::*;
pub use strings::*;
pub use system::*;
pub use util::*;
pub use viewers::*;
#[cfg(feature = "sqlite")]

View File

@ -1,5 +1,6 @@
use crate::{grapheme_flags, util};
use crate::grapheme_flags;
use nu_cmd_base::input_handler::{operate, CmdArgument};
use nu_cmd_base::util;
use nu_engine::CallExt;
use nu_protocol::{
ast::{Call, CellPath},

View File

@ -1,5 +1,6 @@
use crate::{grapheme_flags, util};
use crate::grapheme_flags;
use nu_cmd_base::input_handler::{operate, CmdArgument};
use nu_cmd_base::util;
use nu_engine::CallExt;
use nu_protocol::ast::Call;
use nu_protocol::ast::CellPath;

View File

@ -4,7 +4,6 @@ mod any;
mod append;
mod assignment;
mod break_;
mod bytes;
mod cal;
mod cd;
mod compact;

View File

@ -23,7 +23,7 @@ use command::gather_commandline_args;
use log::Level;
use miette::Result;
use nu_cli::gather_parent_env_vars;
use nu_command::get_init_cwd;
use nu_cmd_base::util::get_init_cwd;
use nu_protocol::{engine::EngineState, report_error_new, Value};
use nu_protocol::{util::BufferedReader, PipelineData, RawStream};
use nu_std::load_standard_library;