From 8d4426f2f8eee16ee60253b659bad1b0dc2a02fc Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Mon, 21 Oct 2024 05:54:18 -0500 Subject: [PATCH] add is_const to `help commands` and `scope commands` (#14125) # Description This PR adds `is_const` to `help commands` and `scope commands` so we can see which commands are const commands. ![image](https://github.com/user-attachments/assets/f2269f9d-5042-40e4-b506-34d69096fcd1) --- crates/nu-command/src/help/help_commands.rs | 1 + crates/nu-engine/src/scope.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/nu-command/src/help/help_commands.rs b/crates/nu-command/src/help/help_commands.rs index d7571b9c07..f0f8df9c02 100644 --- a/crates/nu-command/src/help/help_commands.rs +++ b/crates/nu-command/src/help/help_commands.rs @@ -220,6 +220,7 @@ fn build_help_commands(engine_state: &EngineState, span: Span) -> Vec { "params" => param_table, "input_output" => input_output_table, "search_terms" => Value::string(search_terms.join(", "), span), + "is_const" => Value::bool(decl.is_const(), span), }; found_cmds_vec.push(Value::record(record, span)); diff --git a/crates/nu-engine/src/scope.rs b/crates/nu-engine/src/scope.rs index bbc44f5186..62acd6a9a7 100644 --- a/crates/nu-engine/src/scope.rs +++ b/crates/nu-engine/src/scope.rs @@ -113,6 +113,7 @@ impl<'e, 's> ScopeData<'e, 's> { "examples" => Value::list(examples, span), "type" => Value::string(decl.command_type().to_string(), span), "is_sub" => Value::bool(decl.is_sub(), span), + "is_const" => Value::bool(decl.is_const(), span), "creates_scope" => Value::bool(signature.creates_scope, span), "extra_description" => Value::string(decl.extra_description(), span), "search_terms" => Value::string(decl.search_terms().join(", "), span),