Rename $env.config.explore_config to $env.config.explore (for consistency with $env.config.ls, $env.config.table etc.) (#7317)

# Description

* `$env.config.explore_config` renamed to `$env.config.explore`. This
follows the principle that config subrecords relating to single commands
(as this relates to `explore`) should be exactly named after the command
(see `ls`, `rm`, `table` etc.)
* In `into_config()`, moved the match arm relating to
`$env.config.explore` out of the "legacy options" section (which is
slated for removal in a later version).

# User-Facing Changes

`explore` is not in any public releases yet, so this has no end-user
impact.

# 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.
This commit is contained in:
Leon
2022-12-02 16:42:18 +10:00
committed by GitHub
parent 94c89eb623
commit f491d3e1e1
3 changed files with 24 additions and 26 deletions

View File

@ -87,7 +87,7 @@ pub struct Config {
pub show_banner: bool,
pub show_clickable_links_in_ls: bool,
pub render_right_prompt_on_last_line: bool,
pub explore_config: HashMap<String, Value>,
pub explore: HashMap<String, Value>,
}
impl Default for Config {
@ -126,7 +126,7 @@ impl Default for Config {
show_banner: true,
show_clickable_links_in_ls: true,
render_right_prompt_on_last_line: false,
explore_config: HashMap::new(),
explore: HashMap::new(),
}
}
}
@ -526,6 +526,13 @@ impl Value {
eprintln!("$env.config.{} is not a record", key)
}
}
"explore" => {
if let Ok(map) = create_map(value, &config) {
config.explore = map;
} else {
eprintln!("$env.config.{} is not a record", key)
}
}
// Misc. options
"color_config" => {
if let Ok(map) = create_map(value, &config) {
@ -813,13 +820,6 @@ impl Value {
eprintln!("$env.config.filesize_format is not a string")
}
}
"explore_config" => {
if let Ok(map) = create_map(value, &config) {
config.explore_config = map;
} else {
eprintln!("$env.config.explore_config is not a map")
}
}
// End legacy options
x => {
eprintln!("$env.config.{} is an unknown config setting", x)