Skip to content

Commit 412d7b7

Browse files
authored
chore: Update readme (#354)
1 parent 92ea897 commit 412d7b7

File tree

5 files changed

+26
-19
lines changed

5 files changed

+26
-19
lines changed

README.md

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,46 +27,53 @@ yarn global add table-printer-cli
2727

2828
## Basic Example
2929

30-
Try this on your terminal.
30+
Try this simple example first:
3131

3232
```bash
33-
ctp -i '[{ "id":3, "text":"like" }, {"id":4, "text":"tea"}]'
33+
ctp -i '[{"name":"Alice","score":95},{"name":"Bob","score":82}]'
3434
```
3535

36-
Output:
36+
![Basic Example](https://cdn.jsdelivr.net/gh/console-table-printer/table-printer-cli@master/static-resources/1.quick-print.v4.png)
3737

38-
![Screenshot](https://cdn.jsdelivr.net/gh/console-table-printer/table-printer-cli@master/static-resources/quick-print.v3.png)
39-
40-
You can also pipe the input from stdin:
38+
You can also pipe JSON data from other commands:
4139

4240
```bash
43-
echo '[{ "id":3, "text":"like" }, {"id":4, "text":"tea"}]' | ctp -s
41+
# Pipe data from another command
42+
echo '[{"name":"Alice","role":"Developer"},{"name":"Bob","role":"Designer"}]' | ctp -s
4443
```
4544

46-
### Using Table Options
45+
![Pipe Example](https://cdn.jsdelivr.net/gh/console-table-printer/table-printer-cli@master/static-resources/2.pipe-data.v1.png)
4746

48-
You can customize the table output using the `--tableOptions` parameter. This accepts the same options as the [console-table-printer](https://www.npmjs.com/package/console-table-printer) library.
47+
### Using Table Options
4948

50-
Example with table options:
49+
Customize your tables with colors, styles, and more using the `--tableOptions` parameter. These options are compatible with [console-table-printer](https://www.npmjs.com/package/console-table-printer) library.
5150

5251
```bash
53-
# Use custom column styles
54-
ctp -i '[{"id":1,"status":"active"},{"id":2,"status":"inactive"}]' --tableOptions '{"columns": [{"name": "status", "color": "green"}]}'
55-
56-
# Change table title
57-
ctp -i '[{"id":1,"name":"John"}]' --tableOptions '{"title": "Users List"}'
52+
# Colorize specific columns
53+
ctp -i '[
54+
{"name": "John", "status": "active", "score": 95},
55+
{"name": "Jane", "status": "inactive", "score": 82},
56+
{"name": "Bob", "status": "active", "score": 78}
57+
]' --tableOptions '{
58+
"title": "Employee Status",
59+
"columns": [
60+
{"name": "status", "color": "green", "alignment": "right"},
61+
{"name": "score", "color": "yellow"}
62+
]
63+
}'
5864
```
65+
![Complex Example](https://cdn.jsdelivr.net/gh/console-table-printer/table-printer-cli@master/static-resources/3.complex-example1.v1.png)
5966

60-
## Detailed usage
67+
## Detailed Usage
6168

6269
```text
6370
Usage: ctp [options]
6471
6572
Options:
6673
-i, --input <value> input string
67-
-s, --stdin read input from stdin
68-
-t, --tableOptions <value> table options in JSON format
69-
-h, --help display help for command
74+
-s, --stdin read input from stdin
75+
-t, --tableOptions <value> table options in JSON format
76+
-h, --help display help for command
7077
```
7178

7279
## License
18.1 KB
Loading
22.6 KB
Loading
39.8 KB
Loading
-4.64 KB
Binary file not shown.

0 commit comments

Comments
 (0)