From 2ae1de2470782625145b6cc20121b5e38bb681e7 Mon Sep 17 00:00:00 2001 From: JT <547158+jntrnr@users.noreply.github.com> Date: Sun, 20 Aug 2023 08:43:53 +1200 Subject: [PATCH] move 'bytes' back to commands (#10051) # Description Moves the `bytes XXXX` commands back to the default set. --- crates/nu-cmd-extra/src/extra/mod.rs | 30 ------------------- .../src/extra => nu-command/src}/bytes/add.rs | 0 .../src/extra => nu-command/src}/bytes/at.rs | 0 .../extra => nu-command/src}/bytes/build_.rs | 0 .../extra => nu-command/src}/bytes/bytes_.rs | 0 .../extra => nu-command/src}/bytes/collect.rs | 0 .../src}/bytes/ends_with.rs | 0 .../src}/bytes/index_of.rs | 0 .../extra => nu-command/src}/bytes/length.rs | 0 .../src/extra => nu-command/src}/bytes/mod.rs | 0 .../extra => nu-command/src}/bytes/remove.rs | 0 .../extra => nu-command/src}/bytes/replace.rs | 0 .../extra => nu-command/src}/bytes/reverse.rs | 0 .../src}/bytes/starts_with.rs | 0 crates/nu-command/src/default_context.rs | 16 ++++++++++ crates/nu-command/src/lib.rs | 2 ++ 16 files changed, 18 insertions(+), 30 deletions(-) rename crates/{nu-cmd-extra/src/extra => nu-command/src}/bytes/add.rs (100%) rename crates/{nu-cmd-extra/src/extra => nu-command/src}/bytes/at.rs (100%) rename crates/{nu-cmd-extra/src/extra => nu-command/src}/bytes/build_.rs (100%) rename crates/{nu-cmd-extra/src/extra => nu-command/src}/bytes/bytes_.rs (100%) rename crates/{nu-cmd-extra/src/extra => nu-command/src}/bytes/collect.rs (100%) rename crates/{nu-cmd-extra/src/extra => nu-command/src}/bytes/ends_with.rs (100%) rename crates/{nu-cmd-extra/src/extra => nu-command/src}/bytes/index_of.rs (100%) rename crates/{nu-cmd-extra/src/extra => nu-command/src}/bytes/length.rs (100%) rename crates/{nu-cmd-extra/src/extra => nu-command/src}/bytes/mod.rs (100%) rename crates/{nu-cmd-extra/src/extra => nu-command/src}/bytes/remove.rs (100%) rename crates/{nu-cmd-extra/src/extra => nu-command/src}/bytes/replace.rs (100%) rename crates/{nu-cmd-extra/src/extra => nu-command/src}/bytes/reverse.rs (100%) rename crates/{nu-cmd-extra/src/extra => nu-command/src}/bytes/starts_with.rs (100%) diff --git a/crates/nu-cmd-extra/src/extra/mod.rs b/crates/nu-cmd-extra/src/extra/mod.rs index 2f65f92924..c8d189a930 100644 --- a/crates/nu-cmd-extra/src/extra/mod.rs +++ b/crates/nu-cmd-extra/src/extra/mod.rs @@ -1,5 +1,4 @@ mod bits; -mod bytes; mod conversions; mod filters; mod formats; @@ -7,19 +6,6 @@ mod math; mod platform; mod strings; -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; - pub use bits::Bits; pub use bits::BitsAnd; pub use bits::BitsInto; @@ -111,22 +97,6 @@ pub fn add_extra_command_context(mut engine_state: EngineState) -> EngineState { BitsXor } - // Bytes - bind_command! { - Bytes, - BytesLen, - BytesStartsWith, - BytesEndsWith, - BytesReverse, - BytesReplace, - BytesAdd, - BytesAt, - BytesIndexOf, - BytesCollect, - BytesRemove, - BytesBuild - } - // Math bind_command! { MathArcSin, diff --git a/crates/nu-cmd-extra/src/extra/bytes/add.rs b/crates/nu-command/src/bytes/add.rs similarity index 100% rename from crates/nu-cmd-extra/src/extra/bytes/add.rs rename to crates/nu-command/src/bytes/add.rs diff --git a/crates/nu-cmd-extra/src/extra/bytes/at.rs b/crates/nu-command/src/bytes/at.rs similarity index 100% rename from crates/nu-cmd-extra/src/extra/bytes/at.rs rename to crates/nu-command/src/bytes/at.rs diff --git a/crates/nu-cmd-extra/src/extra/bytes/build_.rs b/crates/nu-command/src/bytes/build_.rs similarity index 100% rename from crates/nu-cmd-extra/src/extra/bytes/build_.rs rename to crates/nu-command/src/bytes/build_.rs diff --git a/crates/nu-cmd-extra/src/extra/bytes/bytes_.rs b/crates/nu-command/src/bytes/bytes_.rs similarity index 100% rename from crates/nu-cmd-extra/src/extra/bytes/bytes_.rs rename to crates/nu-command/src/bytes/bytes_.rs diff --git a/crates/nu-cmd-extra/src/extra/bytes/collect.rs b/crates/nu-command/src/bytes/collect.rs similarity index 100% rename from crates/nu-cmd-extra/src/extra/bytes/collect.rs rename to crates/nu-command/src/bytes/collect.rs diff --git a/crates/nu-cmd-extra/src/extra/bytes/ends_with.rs b/crates/nu-command/src/bytes/ends_with.rs similarity index 100% rename from crates/nu-cmd-extra/src/extra/bytes/ends_with.rs rename to crates/nu-command/src/bytes/ends_with.rs diff --git a/crates/nu-cmd-extra/src/extra/bytes/index_of.rs b/crates/nu-command/src/bytes/index_of.rs similarity index 100% rename from crates/nu-cmd-extra/src/extra/bytes/index_of.rs rename to crates/nu-command/src/bytes/index_of.rs diff --git a/crates/nu-cmd-extra/src/extra/bytes/length.rs b/crates/nu-command/src/bytes/length.rs similarity index 100% rename from crates/nu-cmd-extra/src/extra/bytes/length.rs rename to crates/nu-command/src/bytes/length.rs diff --git a/crates/nu-cmd-extra/src/extra/bytes/mod.rs b/crates/nu-command/src/bytes/mod.rs similarity index 100% rename from crates/nu-cmd-extra/src/extra/bytes/mod.rs rename to crates/nu-command/src/bytes/mod.rs diff --git a/crates/nu-cmd-extra/src/extra/bytes/remove.rs b/crates/nu-command/src/bytes/remove.rs similarity index 100% rename from crates/nu-cmd-extra/src/extra/bytes/remove.rs rename to crates/nu-command/src/bytes/remove.rs diff --git a/crates/nu-cmd-extra/src/extra/bytes/replace.rs b/crates/nu-command/src/bytes/replace.rs similarity index 100% rename from crates/nu-cmd-extra/src/extra/bytes/replace.rs rename to crates/nu-command/src/bytes/replace.rs diff --git a/crates/nu-cmd-extra/src/extra/bytes/reverse.rs b/crates/nu-command/src/bytes/reverse.rs similarity index 100% rename from crates/nu-cmd-extra/src/extra/bytes/reverse.rs rename to crates/nu-command/src/bytes/reverse.rs diff --git a/crates/nu-cmd-extra/src/extra/bytes/starts_with.rs b/crates/nu-command/src/bytes/starts_with.rs similarity index 100% rename from crates/nu-cmd-extra/src/extra/bytes/starts_with.rs rename to crates/nu-command/src/bytes/starts_with.rs diff --git a/crates/nu-command/src/default_context.rs b/crates/nu-command/src/default_context.rs index a3422179a9..a8c23bd17d 100644 --- a/crates/nu-command/src/default_context.rs +++ b/crates/nu-command/src/default_context.rs @@ -325,6 +325,22 @@ pub fn add_shell_command_context(mut engine_state: EngineState) -> EngineState { MathLog, }; + // Bytes + bind_command! { + Bytes, + BytesLen, + BytesStartsWith, + BytesEndsWith, + BytesReverse, + BytesReplace, + BytesAdd, + BytesAt, + BytesIndexOf, + BytesCollect, + BytesRemove, + BytesBuild + } + // Network bind_command! { Http, diff --git a/crates/nu-command/src/lib.rs b/crates/nu-command/src/lib.rs index f694822fb4..276f359e8d 100644 --- a/crates/nu-command/src/lib.rs +++ b/crates/nu-command/src/lib.rs @@ -1,3 +1,4 @@ +mod bytes; mod charting; mod conversions; mod date; @@ -27,6 +28,7 @@ mod strings; mod system; mod viewers; +pub use bytes::*; pub use charting::*; pub use conversions::*; pub use date::*;