Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark match as deprecated command #4802

Merged
merged 1 commit into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Mark match as deprecated command
  • Loading branch information
hustcer committed Mar 10, 2022
commit 6d80d9453d20cd54cbfbbc43e36cd12becdedcc8
1 change: 1 addition & 0 deletions crates/nu-command/src/default_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ pub fn create_default_context(cwd: impl AsRef<Path>) -> EngineState {
StrDatetimeDeprecated,
StrDecimalDeprecated,
StrIntDeprecated,
MatchDeprecated,
NthDeprecated,
UnaliasDeprecated,
};
Expand Down
36 changes: 36 additions & 0 deletions crates/nu-command/src/deprecated/match_.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, PipelineData, Signature,
};

#[derive(Clone)]
pub struct MatchDeprecated;

impl Command for MatchDeprecated {
fn name(&self) -> &str {
"match"
}

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<nu_protocol::PipelineData, nu_protocol::ShellError> {
Err(nu_protocol::ShellError::DeprecatedCommand(
self.name().to_string(),
"find".to_string(),
call.head,
))
}
}
2 changes: 2 additions & 0 deletions crates/nu-command/src/deprecated/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod insert;
mod match_;
mod nth;
mod pivot;
mod str_datetime;
Expand All @@ -7,6 +8,7 @@ mod str_int;
mod unalias;

pub use insert::InsertDeprecated;
pub use match_::MatchDeprecated;
pub use nth::NthDeprecated;
pub use pivot::PivotDeprecated;
pub use str_datetime::StrDatetimeDeprecated;
Expand Down