nushell/crates/nu-command/src/deprecated/deprecated_commands.rs
Darren Schroeder 9777d755d5
add benchmark to deprecated commands (#8046)
# Description

This PR adds a deprecated message to the `benchmark` command.
```
> benchmark
Error: nu:🐚:deprecated_command (link)

  × Deprecated command benchmark
   ╭─[entry #1:1:1]
 1 │ benchmark
   · ────┬────
   ·     ╰── 'benchmark' is deprecated. Please use 'timeit' instead.
   ╰────
```

# User-Facing Changes

# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
2023-02-11 21:39:55 +00:00

28 lines
1.2 KiB
Rust

use std::collections::HashMap;
/// Return map of <deprecated_command_name, new_command_name>
/// This covers simple deprecated commands nicely, but it's not great for deprecating
/// subcommands like `foo bar` where `foo` is still a valid command.
/// For those, it's currently easiest to have a "stub" command that just returns an error.
pub fn deprecated_commands() -> HashMap<String, String> {
HashMap::from([
("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()),
])
}