mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 09:15:42 +02:00
feat[table]: Allow specific table width with -w
, like command grid
. (#5643)
This commit is contained in:
@ -491,14 +491,20 @@ pub fn draw_table(
|
||||
config: &Config,
|
||||
) -> String {
|
||||
// Remove the edges, if used
|
||||
let termwidth = if table.theme.print_left_border && table.theme.print_right_border {
|
||||
termwidth - 3
|
||||
let edges_width = if table.theme.print_left_border && table.theme.print_right_border {
|
||||
3
|
||||
} else if table.theme.print_left_border || table.theme.print_right_border {
|
||||
termwidth - 1
|
||||
1
|
||||
} else {
|
||||
termwidth
|
||||
0
|
||||
};
|
||||
|
||||
if termwidth < edges_width {
|
||||
return format!("Couldn't fit table into {} columns!", termwidth);
|
||||
}
|
||||
|
||||
let termwidth = termwidth - edges_width;
|
||||
|
||||
let mut processed_table = process_table(table);
|
||||
|
||||
let max_per_column = get_max_column_widths(&processed_table);
|
||||
|
Reference in New Issue
Block a user