mirror of
https://github.com/nushell/nushell.git
synced 2025-02-18 03:21:05 +01:00
Fix to md --pretty
when rendering a list (#5932)
Fixes #5931 Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
parent
3917fda7ed
commit
be7f35246e
@ -54,6 +54,11 @@ impl Command for ToMd {
|
|||||||
"# Welcome to Nushell\n| foo | bar |\n| --- | --- |\n| 1 | 2 |",
|
"# Welcome to Nushell\n| foo | bar |\n| --- | --- |\n| 1 | 2 |",
|
||||||
)),
|
)),
|
||||||
},
|
},
|
||||||
|
Example {
|
||||||
|
description: "Render a list",
|
||||||
|
example: "[0 1 2] | to md --pretty",
|
||||||
|
result: Some(Value::test_string("0\n1\n2")),
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +296,7 @@ fn get_output_string(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i in 0..row.len() {
|
for i in 0..row.len() {
|
||||||
if pretty {
|
if pretty && column_widths.get(i).is_some() {
|
||||||
output_string.push(' ');
|
output_string.push(' ');
|
||||||
output_string.push_str(&get_padded_string(row[i].clone(), column_widths[i], ' '));
|
output_string.push_str(&get_padded_string(row[i].clone(), column_widths[i], ' '));
|
||||||
output_string.push(' ');
|
output_string.push(' ');
|
||||||
|
Loading…
Reference in New Issue
Block a user