mirror of
https://github.com/nushell/nushell.git
synced 2025-06-05 01:26:42 +02:00
add tool function to compute the true indentation and newline
This commit is contained in:
parent
1d11c388e3
commit
ff93bb6894
@ -258,6 +258,20 @@ pub fn value_to_string(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_true_indentation(depth: usize, indent: &Option<String>) -> String {
|
||||||
|
match indent {
|
||||||
|
Some(i) => i.repeat(depth),
|
||||||
|
None => "".to_string(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_true_newline(indent: &Option<String>) -> String {
|
||||||
|
match indent {
|
||||||
|
Some(_) => "\n".to_string(),
|
||||||
|
None => "".to_string(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn value_to_string_without_quotes(
|
fn value_to_string_without_quotes(
|
||||||
v: &Value,
|
v: &Value,
|
||||||
span: Span,
|
span: Span,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user