mirror of
https://github.com/nushell/nushell.git
synced 2025-07-12 12:26:05 +02:00
# 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`
44 lines
1.3 KiB
Rust
44 lines
1.3 KiB
Rust
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,
|
|
))
|
|
}
|
|
}
|