forked from extern/nushell
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:
committed by
GitHub
parent
0a5f41abc2
commit
435348aa61
43
crates/nu-command/src/removed/let_env.rs
Normal file
43
crates/nu-command/src/removed/let_env.rs
Normal file
@ -0,0 +1,43 @@
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, PipelineData, ShellError, Signature, SyntaxShape, Type};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct LetEnv;
|
||||
|
||||
impl Command for LetEnv {
|
||||
fn name(&self) -> &str {
|
||||
"let-env"
|
||||
}
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build(self.name())
|
||||
.input_output_types(vec![(Type::Nothing, Type::Nothing)])
|
||||
.allow_variants_without_examples(true)
|
||||
.optional("var_name", SyntaxShape::String, "variable name")
|
||||
.optional(
|
||||
"initial_value",
|
||||
SyntaxShape::Keyword(b"=".to_vec(), Box::new(SyntaxShape::MathExpression)),
|
||||
"equals sign followed by value",
|
||||
)
|
||||
.category(Category::Removed)
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"`let-env FOO = ...` has been removed, use `$env.FOO = ...` instead."
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
_: &EngineState,
|
||||
_: &mut Stack,
|
||||
call: &Call,
|
||||
_: PipelineData,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
Err(nu_protocol::ShellError::RemovedCommand(
|
||||
self.name().to_string(),
|
||||
"$env.<environment variable> = ...".to_owned(),
|
||||
call.head,
|
||||
))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user