From ff3a0a0de387e2ddb712b4da70bb53d3b87defe5 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Mon, 23 Oct 2023 13:22:32 -0500 Subject: [PATCH] fix main not building due to errors later found in describe (#10821) # Description This is just a fixup PR. There was a describe PR that passed CI but then later didn't pass main. This PR fixes that issue. # User-Facing Changes # Tests + Formatting # After Submitting --- .../nu-cmd-lang/src/core_commands/describe.rs | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/crates/nu-cmd-lang/src/core_commands/describe.rs b/crates/nu-cmd-lang/src/core_commands/describe.rs index a3803a5961..7445395287 100644 --- a/crates/nu-cmd-lang/src/core_commands/describe.rs +++ b/crates/nu-cmd-lang/src/core_commands/describe.rs @@ -1,6 +1,6 @@ -use nu_protocol::ast::Call; -use nu_protocol::engine::{Command, EngineState, Stack, StateWorkingSet}; use nu_protocol::{ + ast::Call, + engine::{Command, EngineState, Stack, StateWorkingSet}, record, Category, Example, IntoPipelineData, PipelineData, PipelineMetadata, Record, ShellError, Signature, Type, Value, }; @@ -110,28 +110,36 @@ impl Command for Describe { )), ))), }, - // TODO: Uncomment these tests when/if we allow external commands in examples. - /* Example { description: "Describe the type of a stream with detailed information", - example: "[1 2 3] | each {|i| $i} | describe -d", - result: Some(Value::test_record(record!( - "type" => Value::test_string("stream"), - "origin" => Value::test_string("nushell"), - "subtype" => Value::test_string("int"), - ))), + example: "[1 2 3] | each {|i| echo $i} | describe -d", + result: None // Give "Running external commands not supported" error + // result: Some(Value::test_record(record!( + // "type" => Value::test_string("stream"), + // "origin" => Value::test_string("nushell"), + // "subtype" => Value::test_record(record!( + // "type" => Value::test_string("list"), + // "length" => Value::test_int(3), + // "values" => Value::test_list(vec![ + // Value::test_string("int"), + // Value::test_string("int"), + // Value::test_string("int"), + // ]) + // )) + // ))), }, Example { description: "Describe a stream of data, collecting it first", - example: "[1 2 3] | each {|i| $i} | describe", - result: Some(Value::test_string("list (stream)")), + example: "[1 2 3] | each {|i| echo $i} | describe", + result: None // Give "Running external commands not supported" error + // result: Some(Value::test_string("list (stream)")), }, Example { description: "Describe the input but do not collect streams", - example: "[1 2 3] | each {|i| $i} | describe --no-collect", - result: Some(Value::test_string("stream")), + example: "[1 2 3] | each {|i| echo $i} | describe --no-collect", + result: None // Give "Running external commands not supported" error + // result: Some(Value::test_string("stream")), }, - */ ] } @@ -145,10 +153,8 @@ fn run( call: &Call, input: PipelineData, ) -> Result { - let metadata = input.metadata().clone(); - + let metadata = input.metadata().clone().map(Box::new); let head = call.head; - let no_collect: bool = call.has_flag("no-collect"); let detailed = call.has_flag("detailed");