From c5fc7cd585efb0edd74effecb138ffc4581df690 Mon Sep 17 00:00:00 2001 From: amtoine Date: Sat, 11 Mar 2023 12:04:05 +0100 Subject: [PATCH] do the records --- crates/nu-command/src/formats/to/nuon.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/nu-command/src/formats/to/nuon.rs b/crates/nu-command/src/formats/to/nuon.rs index 0c5bff2055..f74ab1740c 100644 --- a/crates/nu-command/src/formats/to/nuon.rs +++ b/crates/nu-command/src/formats/to/nuon.rs @@ -240,19 +240,22 @@ pub fn value_to_string( for (col, val) in cols.iter().zip(vals) { collection.push(if needs_quotes(col) { format!( - "\"{}\": {}", + "{idt_po}\"{}\": {}", col, value_to_string_without_quotes(val, span, depth + 1, indent)? ) } else { format!( - "{}: {}", + "{idt_po}{}: {}", col, value_to_string_without_quotes(val, span, depth + 1, indent)? ) }); } - Ok(format!("{{{}}}", collection.join(", "))) + Ok(format!( + "{{{nl}{}{nl}{idt}}}", + collection.join(&format!(", {nl}").to_string()) + )) } Value::LazyRecord { val, .. } => { let collected = val.collect()?;