Deprecate split-by command (#14019)

# Description
I'm not quite sure what the point of the `split-by` command is. The only
example for the command seems to suggest it's an additional grouping
command. I.e., a record that seems to be the output of the `group-by`
command is passed to `split-by` which then adds an additional layer of
grouping based on a different column.

# User-Facing Changes
Breaking change, deprecated the command.
This commit is contained in:
Ian Manske 2024-11-21 01:47:03 -08:00 committed by GitHub
parent 4ed25b63a6
commit d8c2493658
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 6 deletions

View File

@ -1,5 +1,6 @@
use indexmap::IndexMap; use indexmap::IndexMap;
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
use nu_protocol::report_shell_warning;
#[derive(Clone)] #[derive(Clone)]
pub struct SplitBy; pub struct SplitBy;
@ -27,6 +28,15 @@ impl Command for SplitBy {
call: &Call, call: &Call,
input: PipelineData, input: PipelineData,
) -> Result<PipelineData, ShellError> { ) -> Result<PipelineData, ShellError> {
report_shell_warning(
engine_state,
&ShellError::Deprecated {
deprecated: "The `split_by` command",
suggestion: "Please use the `group-by` command instead.",
span: call.head,
help: None,
},
);
split_by(engine_state, stack, call, input) split_by(engine_state, stack, call, input)
} }

View File

@ -1330,14 +1330,15 @@ This is an internal Nushell error, please file an issue https://github.com/nushe
span: Span, span: Span,
}, },
#[error("Deprecated: {old_command}")] #[error("{deprecated} is deprecated and will be removed in a future release")]
#[diagnostic(help("for more info see {url}"))] #[diagnostic()]
Deprecated { Deprecated {
old_command: String, deprecated: &'static str,
new_suggestion: String, suggestion: &'static str,
#[label("`{old_command}` is deprecated and will be removed in a future release. Please {new_suggestion} instead.")] #[label("{deprecated} is deprecated. {suggestion}")]
span: Span, span: Span,
url: String, #[help]
help: Option<&'static str>,
}, },
/// Invalid glob pattern /// Invalid glob pattern