cli-table
Rust crate for printing tables on command line.
Usage
Add cli-table
in your Cargo.toms
's dependencies
section
[]
= "0.4"
Simple usage
use ;
let table = vec!
.table
.title
.bold;
assert!;
Below is the output of the table we created just now:
+------------+----------------+
Derive macro
#[derive(Table)]
can also be used to print a Vec
or slice of struct
s as table.
use ;
let users = vec!;
assert!;
Below is the output of the table we created using derive macro:
+----+------------+-----------+
Field attributes
title
|name
: Used to specify title of a column. Usage:#[table(title = "Title")]
justify
: Used to horizontally justify the contents of a column. Usage:#[table(justify = "Justify::Right")]
align
: Used to vertically align the contents of a column. Usage:#[table(align = "Align::Top")]
color
: Used to specify color of contents of a column. Usage:#[table(color = "Color::Red")]
bold
: Used to specify boldness of contents of a column. Usage:#[table(bold)]
skip
: Used to skip a field from table. Usage:#[table(skip)]
For more information on configurations available on derive macro, go to cli-table/examples/struct.rs
.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.