From ff93bb68940dceaa8c5bee699c55eb3f968744cb Mon Sep 17 00:00:00 2001 From: amtoine Date: Sat, 11 Mar 2023 11:34:03 +0100 Subject: [PATCH] add tool function to compute the true indentation and newline --- crates/nu-command/src/formats/to/nuon.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/nu-command/src/formats/to/nuon.rs b/crates/nu-command/src/formats/to/nuon.rs index ff9b2e1683..dcb9e34b88 100644 --- a/crates/nu-command/src/formats/to/nuon.rs +++ b/crates/nu-command/src/formats/to/nuon.rs @@ -258,6 +258,20 @@ pub fn value_to_string( } } +fn get_true_indentation(depth: usize, indent: &Option) -> String { + match indent { + Some(i) => i.repeat(depth), + None => "".to_string(), + } +} + +fn get_true_newline(indent: &Option) -> String { + match indent { + Some(_) => "\n".to_string(), + None => "".to_string(), + } +} + fn value_to_string_without_quotes( v: &Value, span: Span,