Skip to content

Commit

Permalink
remove old deprecated commands (#9840)
Browse files Browse the repository at this point in the history
# Description
in this PR i propose to remove the following old deprecated commands
- `hash base64` -> `encode base64`
- `math eval` -> `math <sub>`
- `str to-datetime` -> `into datetime`
- `str to-decimal` -> `into decimal`
- `str find-replace` -> `str replace`
- `str to-int` -> `into int`
- `keep` -> `take`
- `match` -> `find`
- `nth` -> `select`
- `pivot` -> `transpose`
- `unalias` -> `hide`
- `all?` -> `all`
- `any?` -> `any`
- `empty?` -> `is-empty`
- `build-string` -> `str join` / string concatenation with `+`
- `str lpad` -> `fill`
- `str rpad` -> `fill`
- `str collect` -> `str join`
- `old-alias` -> `alias`

so old i do not remember them at all 😮

i left the following four commands because they have been moved much
more recently i think!
- `fetch` -> `http get`
- `post` -> `http post`
- `benchmark` -> `timeit`
- `let-env`
- `date format` -> `format date`

# User-Facing Changes

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- ⚫ `toolkit test`
- ⚫ `toolkit test stdlib`

# After Submitting
  • Loading branch information
amtoine committed Aug 6, 2023
1 parent 6b4d06d commit dcb1a19
Show file tree
Hide file tree
Showing 14 changed files with 5 additions and 370 deletions.
Empty file modified crates/nu-command/src/charting/histogram.rs 100644 → 100755
Empty file.
13 changes: 2 additions & 11 deletions crates/nu-command/src/default_context.rs
Expand Up @@ -299,8 +299,6 @@ pub fn add_shell_command_context(mut engine_state: EngineState) -> EngineState {

// Env
bind_command! {
LetEnvDeprecated,
DateFormat,
ExportEnv,
LoadEnv,
SourceEnv,
Expand Down Expand Up @@ -382,15 +380,8 @@ pub fn add_shell_command_context(mut engine_state: EngineState) -> EngineState {

// Deprecated
bind_command! {
HashBase64,
LPadDeprecated,
MathEvalDeprecated,
RPadDeprecated,
StrCollectDeprecated,
StrDatetimeDeprecated,
StrDecimalDeprecated,
StrFindReplaceDeprecated,
StrIntDeprecated,
LetEnv,
DateFormat,
};

working_set.render()
Expand Down
34 changes: 0 additions & 34 deletions crates/nu-command/src/deprecated/collect.rs

This file was deleted.

16 changes: 0 additions & 16 deletions crates/nu-command/src/deprecated/deprecated_commands.rs
Expand Up @@ -6,25 +6,9 @@ use std::collections::HashMap;
/// For those, it's currently easiest to have a "stub" command that just returns an error.
pub fn deprecated_commands() -> HashMap<String, String> {
[
("keep".to_string(), "take".to_string()),
("match".to_string(), "find".to_string()),
("nth".to_string(), "select".to_string()),
("pivot".to_string(), "transpose".to_string()),
("unalias".to_string(), "hide".to_string()),
("all?".to_string(), "all".to_string()),
("any?".to_string(), "any".to_string()),
("empty?".to_string(), "is-empty".to_string()),
(
"build-string".to_string(),
"str join'/'string concatenation with '+'".to_string(),
),
("fetch".to_string(), "http get".to_string()),
("post".to_string(), "http post".to_string()),
("str lpad".to_string(), "fill".to_string()),
("str rpad".to_string(), "fill".to_string()),
("benchmark".to_string(), "timeit".to_string()),
("str collect".to_string(), "str join".to_string()),
("old-alias".to_string(), "alias".to_string()),
]
.into_iter()
.collect()
Expand Down
34 changes: 0 additions & 34 deletions crates/nu-command/src/deprecated/hash_base64.rs

This file was deleted.

4 changes: 2 additions & 2 deletions crates/nu-command/src/deprecated/let_env.rs
Expand Up @@ -3,9 +3,9 @@ use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Category, PipelineData, ShellError, Signature, SyntaxShape, Type};

#[derive(Clone)]
pub struct LetEnvDeprecated;
pub struct LetEnv;

impl Command for LetEnvDeprecated {
impl Command for LetEnv {
fn name(&self) -> &str {
"let-env"
}
Expand Down
35 changes: 0 additions & 35 deletions crates/nu-command/src/deprecated/lpad.rs

This file was deleted.

40 changes: 0 additions & 40 deletions crates/nu-command/src/deprecated/math_eval.rs

This file was deleted.

20 changes: 1 addition & 19 deletions crates/nu-command/src/deprecated/mod.rs
@@ -1,25 +1,7 @@
mod collect;
mod deprecated_commands;
mod format;
mod hash_base64;
mod let_env;
mod lpad;
mod math_eval;
mod rpad;
mod str_datetime;
mod str_decimal;
mod str_find_replace;
mod str_int;

pub use collect::StrCollectDeprecated;
pub use deprecated_commands::*;
pub use format::SubCommand as DateFormat;
pub use hash_base64::HashBase64;
pub use let_env::LetEnvDeprecated;
pub use lpad::LPadDeprecated;
pub use math_eval::SubCommand as MathEvalDeprecated;
pub use rpad::RPadDeprecated;
pub use str_datetime::StrDatetimeDeprecated;
pub use str_decimal::StrDecimalDeprecated;
pub use str_find_replace::StrFindReplaceDeprecated;
pub use str_int::StrIntDeprecated;
pub use let_env::LetEnv;
35 changes: 0 additions & 35 deletions crates/nu-command/src/deprecated/rpad.rs

This file was deleted.

36 changes: 0 additions & 36 deletions crates/nu-command/src/deprecated/str_datetime.rs

This file was deleted.

36 changes: 0 additions & 36 deletions crates/nu-command/src/deprecated/str_decimal.rs

This file was deleted.

36 changes: 0 additions & 36 deletions crates/nu-command/src/deprecated/str_find_replace.rs

This file was deleted.

0 comments on commit dcb1a19

Please sign in to comment.