From 2bd345c3672b1bdb3cbac7c9ba397e35c335d2de Mon Sep 17 00:00:00 2001 From: Tyarel <98483313+Tyarel8@users.noreply.github.com> Date: Tue, 21 Jan 2025 16:50:53 +0100 Subject: [PATCH] `into glob`: noop when input is glob (#14882) # Description https://github.com/nushell/nushell/pull/14845#issuecomment-2596371878 When the input to `into glob` is a glob, it will return it like other into commands. # User-Facing Changes Before, using `into glob` with a glob as input would return an error, now it will return the input. --- crates/nu-command/src/conversions/into/glob.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/nu-command/src/conversions/into/glob.rs b/crates/nu-command/src/conversions/into/glob.rs index 9ee8d2a361c..e9354769000 100644 --- a/crates/nu-command/src/conversions/into/glob.rs +++ b/crates/nu-command/src/conversions/into/glob.rs @@ -22,6 +22,7 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("into glob") .input_output_types(vec![ + (Type::Glob, Type::Glob), (Type::String, Type::Glob), ( Type::List(Box::new(Type::String)), @@ -64,6 +65,11 @@ impl Command for SubCommand { example: "'1234' | into glob", result: Some(Value::test_glob("1234")), }, + Example { + description: "convert glob to glob", + example: "'1234' | into glob | into glob", + result: Some(Value::test_glob("1234")), + }, Example { description: "convert filepath to glob", example: "ls Cargo.toml | get name | into glob", @@ -94,6 +100,7 @@ fn glob_helper( fn action(input: &Value, _args: &Arguments, span: Span) -> Value { match input { Value::String { val, .. } => Value::glob(val.to_string(), false, span), + Value::Glob { .. } => input.clone(), x => Value::error( ShellError::CantConvert { to_type: String::from("glob"),