Pretty-print your csv files to the terminal:
```rust use pretty_csv::Table;
let mut csv = &b"one,two\nthree,four"[..]; let table = Table::fromcsv(csv); let mut output = vec![]; table.draw(&mut output).unwrap(); asserteq!( std::str::from_utf8(&output).unwrap(), concat!( "╭───────┬──────╮\n", "│ one │ two │\n", "├───────┼──────┤\n", "│ three │ four │\n", "╰───────┴──────╯\n" ) ); ```
Supports embedding tables in cells:
```rust use pretty_csv::Table;
let mut csv = &b"one,two\n\"[three,four\nfive,six]\",seven"[..]; let table = Table::fromcsv(csv); let mut output = vec![]; table.draw(&mut output).unwrap(); asserteq!( std::str::from_utf8(&output).unwrap(), concat!( "╭──────────────────┬───────╮\n", "│ one │ two │\n", "├──────────────────┼───────┤\n", "│ ╭───────┬──────╮ │ seven │\n", "│ │ three │ four │ │ │\n", "│ ├───────┼──────┤ │ │\n", "│ │ five │ six │ │ │\n", "│ ╰───────┴──────╯ │ │\n", "╰──────────────────┴───────╯\n" ) ); ```
Comes with small cli tool called pretty-csv
:
bash
$ cargo install pretty-csv
$ echo "1,2,3" | pretty-csv
╭───┬───┬───╮
│ 1 │ 2 │ 3 │
╰───┴───┴───╯