diff --git a/crates/nu-command/src/default_context.rs b/crates/nu-command/src/default_context.rs index bc3866ca3a..783a95ec6b 100644 --- a/crates/nu-command/src/default_context.rs +++ b/crates/nu-command/src/default_context.rs @@ -371,6 +371,9 @@ pub fn create_default_context(cwd: impl AsRef) -> EngineState { NthDeprecated, UnaliasDeprecated, StrFindReplaceDeprecated, + KeepDeprecated, + KeepUntilDeprecated, + KeepWhileDeprecated, }; #[cfg(feature = "dataframe")] diff --git a/crates/nu-command/src/deprecated/keep_.rs b/crates/nu-command/src/deprecated/keep_.rs new file mode 100644 index 0000000000..e152f8ab09 --- /dev/null +++ b/crates/nu-command/src/deprecated/keep_.rs @@ -0,0 +1,36 @@ +use nu_protocol::{ + ast::Call, + engine::{Command, EngineState, Stack}, + Category, PipelineData, Signature, +}; + +#[derive(Clone)] +pub struct KeepDeprecated; + +impl Command for KeepDeprecated { + fn name(&self) -> &str { + "keep" + } + + fn signature(&self) -> Signature { + Signature::build(self.name()).category(Category::Deprecated) + } + + fn usage(&self) -> &str { + "Deprecated command" + } + + fn run( + &self, + _engine_state: &EngineState, + _stack: &mut Stack, + call: &Call, + _input: PipelineData, + ) -> Result { + Err(nu_protocol::ShellError::DeprecatedCommand( + self.name().to_string(), + "take".to_string(), + call.head, + )) + } +} diff --git a/crates/nu-command/src/deprecated/keep_until.rs b/crates/nu-command/src/deprecated/keep_until.rs new file mode 100644 index 0000000000..003c5c0dbf --- /dev/null +++ b/crates/nu-command/src/deprecated/keep_until.rs @@ -0,0 +1,36 @@ +use nu_protocol::{ + ast::Call, + engine::{Command, EngineState, Stack}, + Category, PipelineData, Signature, +}; + +#[derive(Clone)] +pub struct KeepUntilDeprecated; + +impl Command for KeepUntilDeprecated { + fn name(&self) -> &str { + "keep until" + } + + fn signature(&self) -> Signature { + Signature::build(self.name()).category(Category::Deprecated) + } + + fn usage(&self) -> &str { + "Deprecated command" + } + + fn run( + &self, + _engine_state: &EngineState, + _stack: &mut Stack, + call: &Call, + _input: PipelineData, + ) -> Result { + Err(nu_protocol::ShellError::DeprecatedCommand( + self.name().to_string(), + "take until".to_string(), + call.head, + )) + } +} diff --git a/crates/nu-command/src/deprecated/keep_while.rs b/crates/nu-command/src/deprecated/keep_while.rs new file mode 100644 index 0000000000..94d916d532 --- /dev/null +++ b/crates/nu-command/src/deprecated/keep_while.rs @@ -0,0 +1,36 @@ +use nu_protocol::{ + ast::Call, + engine::{Command, EngineState, Stack}, + Category, PipelineData, Signature, +}; + +#[derive(Clone)] +pub struct KeepWhileDeprecated; + +impl Command for KeepWhileDeprecated { + fn name(&self) -> &str { + "keep while" + } + + fn signature(&self) -> Signature { + Signature::build(self.name()).category(Category::Deprecated) + } + + fn usage(&self) -> &str { + "Deprecated command" + } + + fn run( + &self, + _engine_state: &EngineState, + _stack: &mut Stack, + call: &Call, + _input: PipelineData, + ) -> Result { + Err(nu_protocol::ShellError::DeprecatedCommand( + self.name().to_string(), + "take while".to_string(), + call.head, + )) + } +} diff --git a/crates/nu-command/src/deprecated/mod.rs b/crates/nu-command/src/deprecated/mod.rs index fbfd61c614..5e3e8ca28f 100644 --- a/crates/nu-command/src/deprecated/mod.rs +++ b/crates/nu-command/src/deprecated/mod.rs @@ -1,3 +1,6 @@ +mod keep_; +mod keep_until; +mod keep_while; mod match_; mod nth; mod pivot; @@ -7,6 +10,9 @@ mod str_find_replace; mod str_int; mod unalias; +pub use keep_::KeepDeprecated; +pub use keep_until::KeepUntilDeprecated; +pub use keep_while::KeepWhileDeprecated; pub use match_::MatchDeprecated; pub use nth::NthDeprecated; pub use pivot::PivotDeprecated;