diff --git a/crates/nu-command/src/default_context.rs b/crates/nu-command/src/default_context.rs index 48db534df3..ccf42f1e76 100644 --- a/crates/nu-command/src/default_context.rs +++ b/crates/nu-command/src/default_context.rs @@ -317,6 +317,7 @@ pub fn create_default_context(cwd: impl AsRef) -> EngineState { WithEnv, ConfigNu, ConfigEnv, + ConfigMeta, }; // Math diff --git a/crates/nu-command/src/env/config/config_.rs b/crates/nu-command/src/env/config/config_.rs new file mode 100644 index 0000000000..d1f41f8284 --- /dev/null +++ b/crates/nu-command/src/env/config/config_.rs @@ -0,0 +1,46 @@ +use nu_engine::get_full_help; +use nu_protocol::{ + ast::Call, + engine::{Command, EngineState, Stack}, + Category, IntoPipelineData, PipelineData, Signature, Value, +}; + +#[derive(Clone)] +pub struct ConfigMeta; + +impl Command for ConfigMeta { + fn name(&self) -> &str { + "config" + } + + fn signature(&self) -> Signature { + Signature::build(self.name()).category(Category::Env) + } + + fn usage(&self) -> &str { + "Edit nushell configuration files" + } + + fn run( + &self, + engine_state: &EngineState, + stack: &mut Stack, + call: &Call, + _input: PipelineData, + ) -> Result { + Ok(Value::String { + val: get_full_help( + &ConfigMeta.signature(), + &ConfigMeta.examples(), + engine_state, + stack, + ), + span: call.head, + } + .into_pipeline_data()) + } + + fn search_terms(&self) -> Vec<&str> { + vec!["options", "setup"] + } +} diff --git a/crates/nu-command/src/env/config/mod.rs b/crates/nu-command/src/env/config/mod.rs index 05d5c4c789..5e70f6315a 100644 --- a/crates/nu-command/src/env/config/mod.rs +++ b/crates/nu-command/src/env/config/mod.rs @@ -1,5 +1,7 @@ +mod config_; mod config_env; mod config_nu; mod utils; +pub use config_::ConfigMeta; pub use config_env::ConfigEnv; pub use config_nu::ConfigNu; diff --git a/crates/nu-command/src/env/mod.rs b/crates/nu-command/src/env/mod.rs index b05581e7a0..e0e1a1820d 100644 --- a/crates/nu-command/src/env/mod.rs +++ b/crates/nu-command/src/env/mod.rs @@ -5,6 +5,7 @@ mod load_env; mod with_env; pub use config::ConfigEnv; +pub use config::ConfigMeta; pub use config::ConfigNu; pub use env_command::Env; pub use let_env::LetEnv;