Skip to content

Commit 69b97c0

Browse files
committed
Update documentation and example with separate title
1 parent 61a4b6c commit 69b97c0

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ cli-table = "0.4"
2222
use cli_table::{format::Justify, print_stdout, Cell, Style, Table};
2323

2424
let table = vec![
25-
vec!["Name".cell().bold(true), "Age (in years)".cell().bold(true)],
2625
vec!["Tom".cell(), 10.cell().justify(Justify::Right)],
2726
vec!["Jerry".cell(), 15.cell().justify(Justify::Right)],
2827
vec!["Scooby Doo".cell(), 20.cell().justify(Justify::Right)],
2928
]
3029
.table()
30+
.title(vec![
31+
"Name".cell().bold(true),
32+
"Age (in years)".cell().bold(true),
33+
])
3134
.bold(true);
3235

3336
assert!(print_stdout(table).is_ok());

cli-table/examples/simple.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ use cli_table::{format::Justify, print_stdout, Cell, Style, Table};
44

55
fn main() -> Result<()> {
66
let table = vec![
7-
vec!["Name".cell().bold(true), "Age (in years)".cell().bold(true)],
87
vec!["Tom".cell(), 10.cell().justify(Justify::Right)],
98
vec!["Jerry".cell(), 15.cell().justify(Justify::Right)],
109
vec!["Scooby Doo".cell(), 20.cell().justify(Justify::Right)],
1110
]
1211
.table()
12+
.title(vec![
13+
"Name".cell().bold(true),
14+
"Age (in years)".cell().bold(true),
15+
])
1316
.bold(true);
1417

1518
print_stdout(table)

cli-table/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@
1919
//! use cli_table::{format::Justify, print_stdout, Cell, Style, Table};
2020
//!
2121
//! let table = vec![
22-
//! vec!["Name".cell().bold(true), "Age (in years)".cell().bold(true)],
2322
//! vec!["Tom".cell(), 10.cell().justify(Justify::Right)],
2423
//! vec!["Jerry".cell(), 15.cell().justify(Justify::Right)],
2524
//! vec!["Scooby Doo".cell(), 20.cell().justify(Justify::Right)],
2625
//! ]
2726
//! .table()
27+
//! .title(vec![
28+
//! "Name".cell().bold(true),
29+
//! "Age (in years)".cell().bold(true),
30+
//! ])
2831
//! .bold(true);
2932
//!
3033
//! assert!(print_stdout(table).is_ok());

0 commit comments

Comments
 (0)