1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | var Table = require('cli-table');
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | var table = new Table({
|
14 | head: ['Rel', 'Change', 'By', 'When']
|
15 | , colWidths: [6, 21, 25, 17]
|
16 | });
|
17 |
|
18 | table.push(
|
19 | ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago']
|
20 | , ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago']
|
21 | );
|
22 |
|
23 | console.log(table.toString());
|
24 |
|
25 |
|
26 |
|
27 | var table = new Table({
|
28 | head: ['Rel', 'Change', 'By', 'When']
|
29 | , colWidths: [6, 21, 25, 17]
|
30 | , style : {compact : true, 'padding-left' : 1}
|
31 | });
|
32 |
|
33 | table.push(
|
34 | ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago']
|
35 | , ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago']
|
36 | , []
|
37 | , ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago']
|
38 | );
|
39 |
|
40 | console.log(table.toString());
|
41 |
|
42 |
|
43 | var headless_table = new Table();
|
44 | headless_table.push(['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago']);
|
45 | console.log(headless_table.toString());
|
46 |
|
47 |
|
48 | var vertical_table = new Table();
|
49 | vertical_table.push({ "Some Key": "Some Value"},
|
50 | { "Another much longer key": "And its corresponding longer value"}
|
51 | );
|
52 |
|
53 | console.log(vertical_table.toString());
|
54 |
|
55 |
|
56 | var cross_table = new Table({ head: ["", "Header #1", "Header #2"] });
|
57 | cross_table.push({ "Header #3": ["Value 1", "Value 2"] },
|
58 | { "Header #4": ["Value 3", "Value 4"] });
|
59 | console.log(cross_table.toString()); |
\ | No newline at end of file |