| 102 | |
| 103 | impl TablePrinter { |
| 104 | fn print_group_as_table( |
| 105 | &self, |
| 106 | titles: &[String], |
| 107 | table_headers: Vec<comfy_table::Cell>, |
| 108 | rows: &[Row], |
| 109 | ) { |
| 110 | let mut table = comfy_table::Table::new(); |
| 111 | |
| 112 | // Setup table style |
| 113 | table.load_preset(comfy_table::presets::UTF8_FULL); |
| 114 | table.apply_modifier(comfy_table::modifiers::UTF8_ROUND_CORNERS); |
| 115 | |
| 116 | if let Some(arrangement) = &self.theme_config.arrangement { |
| 117 | table.set_content_arrangement(arrangement.clone()); |
| 118 | } |
| 119 | |
| 120 | table.set_header(table_headers); |
| 121 | |
| 122 | let titles_len = titles.len(); |
| 123 | |
| 124 | // Add rows to the table |
| 125 | for row in rows { |
| 126 | let mut table_row: Vec<comfy_table::Cell> = vec![]; |
| 127 | for index in 0..titles_len { |
| 128 | if let Some(value) = row.values.get(index) { |
| 129 | table_row.push(comfy_table::Cell::new(value.literal())); |
| 130 | } |
| 131 | } |
| 132 | table.add_row(table_row); |
| 133 | } |
| 134 | |
| 135 | // Print table |
| 136 | println!("{table}"); |
| 137 | } |
| 138 | |
| 139 | fn handle_pagination_input( |
| 140 | &self, |