explore: remove :config, :show-config, :tweak commands (#10259)

More trimming of underused `explore` functionality.

The `explore` command has subcommands that can be run like `:config` or
`:try` or whatnot. This PR removes the `:config`, `:show-config`, and
`:tweak` commands which are all for viewing+modifying config.

These are interesting commands and they were cool experiments, but
ultimately I don't think they fit with our plans for a simplified
`explore`. They'd need a lot more polish if we want to keep them and I
don't think we do. Happy to discuss if I've missed a good reason to keep
these.

cc @fdncred
This commit is contained in:
Reilly Wood
2023-09-07 08:34:08 -07:00
committed by GitHub
parent c7c6445b03
commit b6189879e3
16 changed files with 2 additions and 1010 deletions

View File

@ -11,10 +11,7 @@ pub use explore::Explore;
use std::io;
use commands::{
config::ConfigCmd, default_color_list, ConfigOption, ConfigShowCmd, ExpandCmd, HelpCmd,
HelpManual, NuCmd, QuitCmd, TableCmd, TryCmd, TweakCmd,
};
use commands::{ExpandCmd, HelpCmd, HelpManual, NuCmd, QuitCmd, TableCmd, TryCmd};
use nu_common::{collect_pipeline, has_simple_value, CtrlC};
use nu_protocol::{
engine::{EngineState, Stack},
@ -96,10 +93,8 @@ fn create_command_registry() -> CommandRegistry {
let aliases = registry.get_aliases().collect::<Vec<_>>();
let help_cmd = create_help_command(&commands, &aliases);
let config_cmd = create_config_command(&commands);
registry.register_command_view(help_cmd, true);
registry.register_command_view(config_cmd, true);
registry
}
@ -110,12 +105,9 @@ fn create_commands(registry: &mut CommandRegistry) {
registry.register_command_view(ExpandCmd::new(), true);
registry.register_command_view(TryCmd::new(), true);
registry.register_command_view(ConfigShowCmd::new(), true);
registry.register_command_view(ConfigCmd::default(), true);
registry.register_command_view(HelpCmd::default(), true);
registry.register_command_reactive(QuitCmd);
registry.register_command_reactive(TweakCmd::default());
}
fn create_aliases(registry: &mut CommandRegistry) {
@ -125,28 +117,6 @@ fn create_aliases(registry: &mut CommandRegistry) {
registry.create_aliases("q!", QuitCmd::NAME);
}
#[rustfmt::skip]
fn create_config_command(commands: &[Command]) -> ConfigCmd {
const GROUP: &str = "Explore configuration";
let mut config = ConfigCmd::from_commands(commands.to_vec());
config.register_group(ConfigOption::new(GROUP, "Status bar information color", "status.info", default_color_list()));
config.register_group(ConfigOption::new(GROUP, "Status bar success color", "status.success", default_color_list()));
config.register_group(ConfigOption::new(GROUP, "Status bar warning color", "status.warn", default_color_list()));
config.register_group(ConfigOption::new(GROUP, "Status bar error color", "status.error", default_color_list()));
config.register_group(ConfigOption::new(GROUP, "Status bar default text color", "status_bar_text", default_color_list()));
config.register_group(ConfigOption::new(GROUP, "Status bar background", "status_bar_background", default_color_list()));
config.register_group(ConfigOption::new(GROUP, "Command bar text color", "command_bar_text", default_color_list()));
config.register_group(ConfigOption::new(GROUP, "Command bar background", "command_bar_background", default_color_list()));
config.register_group(ConfigOption::new(GROUP, "Highlight color in search", "highlight", default_color_list()));
config
}
fn create_help_command(commands: &[Command], aliases: &[(&str, &str)]) -> HelpCmd {
let help_manuals = create_help_manuals(commands);