Rename misused "deprecation" to removal (#10000)

# Description
In the past we named the process of completely removing a command and
providing a basic error message pointing to the new alternative
"deprecation".

But this doesn't match the expectation of most users that have seen
deprecation _warnings_ that alert to either impending removal or
discouraged use after a stability promise.

# User-Facing Changes
Command category changed from `deprecated` to `removed`
This commit is contained in:
Stefan Holderbach
2023-08-14 21:17:31 +02:00
committed by GitHub
parent 0a5f41abc2
commit 435348aa61
12 changed files with 33 additions and 51 deletions

View File

@ -713,7 +713,7 @@ impl EngineState {
for decl in &overlay_frame.decls {
if overlay_frame.visibility.is_decl_id_visible(decl.1) && predicate(decl.0) {
let command = self.get_decl(*decl.1);
if ignore_deprecated && command.signature().category == Category::Deprecated {
if ignore_deprecated && command.signature().category == Category::Removed {
continue;
}
output.push((decl.0.clone(), Some(command.usage().to_string())));
@ -1713,8 +1713,7 @@ impl<'a> StateWorkingSet<'a> {
for decl in &overlay_frame.decls {
if overlay_frame.visibility.is_decl_id_visible(decl.1) && predicate(decl.0) {
let command = self.get_decl(*decl.1);
if ignore_deprecated && command.signature().category == Category::Deprecated
{
if ignore_deprecated && command.signature().category == Category::Removed {
continue;
}
output.push((decl.0.clone(), Some(command.usage().to_string())));

View File

@ -982,30 +982,17 @@ pub enum ShellError {
#[diagnostic()]
OutsideSpannedLabeledError(#[source_code] String, String, String, #[label("{2}")] Span),
/// Attempted to use a deprecated command.
/// Attempted to use a command that has been removed from Nushell.
///
/// ## Resolution
///
/// Check the help for the new suggested command and update your script accordingly.
#[error("Deprecated command {0}")]
#[diagnostic(code(nu::shell::deprecated_command))]
DeprecatedCommand(
#[error("Removed command: {0}")]
#[diagnostic(code(nu::shell::removed_command))]
RemovedCommand(
String,
String,
#[label = "'{0}' is deprecated. Please use '{1}' instead."] Span,
),
/// Attempted to use a deprecated parameter.
///
/// ## Resolution
///
/// Check the help for the command and update your script accordingly.
#[error("Deprecated parameter {0}")]
#[diagnostic(code(nu::shell::deprecated_command))]
DeprecatedParameter(
String,
String,
#[label = "Parameter '{0}' is deprecated. Please use '{1}' instead."] Span,
#[label = "'{0}' has been removed from Nushell. Please use '{1}' instead."] Span,
),
/// Non-Unicode input received.

View File

@ -49,7 +49,7 @@ pub enum Category {
Date,
Debug,
Default,
Deprecated,
Removed,
Env,
Experimental,
FileSystem,
@ -81,7 +81,7 @@ impl std::fmt::Display for Category {
Category::Date => "date",
Category::Debug => "debug",
Category::Default => "default",
Category::Deprecated => "deprecated",
Category::Removed => "removed",
Category::Env => "env",
Category::Experimental => "experimental",
Category::FileSystem => "filesystem",