mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 16:33:37 +01:00
REFACTOR: remove deprecated commands (old-alias
) (#9056)
# Description as stated in the `0.79` release note, this PR removes the `old-alias` and `export old-alias` commands, which were deprecated before. # User-Facing Changes `old-alias` is gone for good 😌 # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting already mentionned in the `0.79` release note.
This commit is contained in:
parent
6bbe5b6255
commit
b82e279f9d
@ -438,11 +438,9 @@ pub fn create_default_context() -> EngineState {
|
|||||||
|
|
||||||
// Deprecated
|
// Deprecated
|
||||||
bind_command! {
|
bind_command! {
|
||||||
ExportOldAlias,
|
|
||||||
HashBase64,
|
HashBase64,
|
||||||
LPadDeprecated,
|
LPadDeprecated,
|
||||||
MathEvalDeprecated,
|
MathEvalDeprecated,
|
||||||
OldAlias,
|
|
||||||
RPadDeprecated,
|
RPadDeprecated,
|
||||||
StrCollectDeprecated,
|
StrCollectDeprecated,
|
||||||
StrDatetimeDeprecated,
|
StrDatetimeDeprecated,
|
||||||
|
@ -24,5 +24,6 @@ pub fn deprecated_commands() -> HashMap<String, String> {
|
|||||||
("str rpad".to_string(), "fill".to_string()),
|
("str rpad".to_string(), "fill".to_string()),
|
||||||
("benchmark".to_string(), "timeit".to_string()),
|
("benchmark".to_string(), "timeit".to_string()),
|
||||||
("str collect".to_string(), "str join".to_string()),
|
("str collect".to_string(), "str join".to_string()),
|
||||||
|
("old-alias".to_string(), "alias".to_string()),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
use nu_protocol::ast::Call;
|
|
||||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
|
||||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type};
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct ExportOldAlias;
|
|
||||||
|
|
||||||
impl Command for ExportOldAlias {
|
|
||||||
fn name(&self) -> &str {
|
|
||||||
"export old-alias"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
|
||||||
"Define an alias and export it from a module."
|
|
||||||
}
|
|
||||||
|
|
||||||
fn signature(&self) -> nu_protocol::Signature {
|
|
||||||
Signature::build("export old-alias")
|
|
||||||
.input_output_types(vec![(Type::Nothing, Type::Nothing)])
|
|
||||||
.required("name", SyntaxShape::String, "name of the alias")
|
|
||||||
.required(
|
|
||||||
"initial_value",
|
|
||||||
SyntaxShape::Keyword(b"=".to_vec(), Box::new(SyntaxShape::Expression)),
|
|
||||||
"equals sign followed by value",
|
|
||||||
)
|
|
||||||
.category(Category::Core)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn extra_usage(&self) -> &str {
|
|
||||||
r#"This command is a parser keyword. For details, check:
|
|
||||||
https://www.nushell.sh/book/thinking_in_nu.html"#
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_parser_keyword(&self) -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run(
|
|
||||||
&self,
|
|
||||||
_engine_state: &EngineState,
|
|
||||||
_stack: &mut Stack,
|
|
||||||
_call: &Call,
|
|
||||||
_input: PipelineData,
|
|
||||||
) -> Result<PipelineData, ShellError> {
|
|
||||||
Ok(PipelineData::empty())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn examples(&self) -> Vec<Example> {
|
|
||||||
vec![Example {
|
|
||||||
description: "export an alias of ll to ls -l, from a module",
|
|
||||||
example: "export old-alias ll = ls -l",
|
|
||||||
result: None,
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
|
|
||||||
fn search_terms(&self) -> Vec<&str> {
|
|
||||||
vec!["aka", "abbr", "module"]
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +1,8 @@
|
|||||||
mod collect;
|
mod collect;
|
||||||
mod deprecated_commands;
|
mod deprecated_commands;
|
||||||
mod export_old_alias;
|
|
||||||
mod hash_base64;
|
mod hash_base64;
|
||||||
mod lpad;
|
mod lpad;
|
||||||
mod math_eval;
|
mod math_eval;
|
||||||
mod old_alias;
|
|
||||||
mod rpad;
|
mod rpad;
|
||||||
mod str_datetime;
|
mod str_datetime;
|
||||||
mod str_decimal;
|
mod str_decimal;
|
||||||
@ -13,11 +11,9 @@ mod str_int;
|
|||||||
|
|
||||||
pub use collect::StrCollectDeprecated;
|
pub use collect::StrCollectDeprecated;
|
||||||
pub use deprecated_commands::*;
|
pub use deprecated_commands::*;
|
||||||
pub use export_old_alias::ExportOldAlias;
|
|
||||||
pub use hash_base64::HashBase64;
|
pub use hash_base64::HashBase64;
|
||||||
pub use lpad::LPadDeprecated;
|
pub use lpad::LPadDeprecated;
|
||||||
pub use math_eval::SubCommand as MathEvalDeprecated;
|
pub use math_eval::SubCommand as MathEvalDeprecated;
|
||||||
pub use old_alias::OldAlias;
|
|
||||||
pub use rpad::RPadDeprecated;
|
pub use rpad::RPadDeprecated;
|
||||||
pub use str_datetime::StrDatetimeDeprecated;
|
pub use str_datetime::StrDatetimeDeprecated;
|
||||||
pub use str_decimal::StrDecimalDeprecated;
|
pub use str_decimal::StrDecimalDeprecated;
|
||||||
|
@ -1,68 +0,0 @@
|
|||||||
use nu_protocol::ast::Call;
|
|
||||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
|
||||||
use nu_protocol::{
|
|
||||||
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct OldAlias;
|
|
||||||
|
|
||||||
impl Command for OldAlias {
|
|
||||||
fn name(&self) -> &str {
|
|
||||||
"old-alias"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
|
||||||
"Alias a command (with optional flags) to a new name."
|
|
||||||
}
|
|
||||||
|
|
||||||
fn signature(&self) -> nu_protocol::Signature {
|
|
||||||
Signature::build("old-alias")
|
|
||||||
.input_output_types(vec![(Type::Nothing, Type::Nothing)])
|
|
||||||
.required("name", SyntaxShape::String, "name of the alias")
|
|
||||||
.required(
|
|
||||||
"initial_value",
|
|
||||||
SyntaxShape::Keyword(b"=".to_vec(), Box::new(SyntaxShape::Expression)),
|
|
||||||
"equals sign followed by value",
|
|
||||||
)
|
|
||||||
.category(Category::Core)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn extra_usage(&self) -> &str {
|
|
||||||
r#"This command is a parser keyword. For details, check:
|
|
||||||
https://www.nushell.sh/book/thinking_in_nu.html"#
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_parser_keyword(&self) -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
fn search_terms(&self) -> Vec<&str> {
|
|
||||||
vec!["abbr", "aka", "fn", "func", "function"]
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run(
|
|
||||||
&self,
|
|
||||||
_engine_state: &EngineState,
|
|
||||||
_stack: &mut Stack,
|
|
||||||
_call: &Call,
|
|
||||||
_input: PipelineData,
|
|
||||||
) -> Result<PipelineData, ShellError> {
|
|
||||||
Ok(PipelineData::empty())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn examples(&self) -> Vec<Example> {
|
|
||||||
vec![
|
|
||||||
Example {
|
|
||||||
description: "Alias ll to ls -l",
|
|
||||||
example: "old-alias ll = ls -l",
|
|
||||||
result: Some(Value::nothing(Span::test_data())),
|
|
||||||
},
|
|
||||||
Example {
|
|
||||||
description: "Make an alias that makes a list of all custom commands",
|
|
||||||
example: "old-alias customs = ($nu.scope.commands | where is_custom | get command)",
|
|
||||||
result: Some(Value::nothing(Span::test_data())),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -285,16 +285,16 @@ def show-alias [alias: record] {
|
|||||||
# > let us define a bunch of aliases
|
# > let us define a bunch of aliases
|
||||||
# > ```nushell
|
# > ```nushell
|
||||||
# > # my foo alias
|
# > # my foo alias
|
||||||
# > old-alias foo = echo "this is foo"
|
# > alias foo = echo "this is foo"
|
||||||
# >
|
# >
|
||||||
# > # my bar alias
|
# > # my bar alias
|
||||||
# > old-alias bar = echo "this is bar"
|
# > alias bar = echo "this is bar"
|
||||||
# >
|
# >
|
||||||
# > # my baz alias
|
# > # my baz alias
|
||||||
# > old-alias baz = echo "this is baz"
|
# > alias baz = echo "this is baz"
|
||||||
# >
|
# >
|
||||||
# > # a multiline alias
|
# > # a multiline alias
|
||||||
# > old-alias multi = echo "this
|
# > alias multi = echo "this
|
||||||
# > is
|
# > is
|
||||||
# > a
|
# > a
|
||||||
# > multiline
|
# > multiline
|
||||||
|
Loading…
Reference in New Issue
Block a user