| 1 | use comfy_table::{presets::UTF8_FULL, *}; |
| 2 | |
| 3 | // This example works even with the `tty` feature disabled |
| 4 | // You can try it out with `cargo run --example no_tty --no-default-features` |
| 5 | |
| 6 | fn main() { |
| 7 | let mut table = Table::new(); |
| 8 | table.load_preset(UTF8_FULL) |
| 9 | .set_content_arrangement(ContentArrangement::Dynamic) |
| 10 | .set_width(80) |
| 11 | .set_header(vec![ |
| 12 | Cell::new("Header1"), |
| 13 | Cell::new("Header2"), |
| 14 | Cell::new("Header3"), |
| 15 | ]) |
| 16 | .add_row(vec![ |
| 17 | Cell::new("No bold text without tty"), |
| 18 | Cell::new("No colored text without tty"), |
| 19 | Cell::new("No custom background without tty"), |
| 20 | ]) |
| 21 | .add_row(vec![ |
| 22 | Cell::new("Blinky boi"), |
| 23 | Cell::new("This table's content is dynamically arranged. The table is exactly 80 characters wide.\nHere comes a reallylongwordthatshoulddynamicallywrap"), |
| 24 | Cell::new("Done"), |
| 25 | ]); |
| 26 | |
| 27 | println!("{table}"); |
| 28 | } |