From 2b431f994f730914f558f53f8f74e9306156a137 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Fri, 4 Aug 2023 14:06:41 -0500 Subject: [PATCH] updates `let-env` signature to remove required params (#9917) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description This PR changes the signature of the deprecated command `let-env` so that it does not mislead people when invoking it without parameters. ### Before ```nushell > let-env Error: nu::parser::missing_positional × Missing required positional argument. ╭─[entry #2:1:1] 1 │ let-env ╰──── help: Usage: let-env = ``` ### After ```nushell ❯ let-env Error: nu::shell::deprecated_command × Deprecated command let-env ╭─[entry #1:1:1] 1 │ let-env · ───┬─── · ╰── 'let-env' is deprecated. Please use '$env. = ...' instead. ╰──── ``` # User-Facing Changes # Tests + Formatting # After Submitting --- crates/nu-command/src/deprecated/let_env.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/nu-command/src/deprecated/let_env.rs b/crates/nu-command/src/deprecated/let_env.rs index 657e1f006e..36192b5922 100644 --- a/crates/nu-command/src/deprecated/let_env.rs +++ b/crates/nu-command/src/deprecated/let_env.rs @@ -14,8 +14,8 @@ impl Command for LetEnvDeprecated { Signature::build(self.name()) .input_output_types(vec![(Type::Nothing, Type::Nothing)]) .allow_variants_without_examples(true) - .required("var_name", SyntaxShape::String, "variable name") - .required( + .optional("var_name", SyntaxShape::String, "variable name") + .optional( "initial_value", SyntaxShape::Keyword(b"=".to_vec(), Box::new(SyntaxShape::MathExpression)), "equals sign followed by value",