Skip to content

Commit e23666f

Browse files
committed
table support
1 parent 1bafb5e commit e23666f

10 files changed

Lines changed: 1490 additions & 26 deletions

File tree

README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ You can specify a [theme](https://pygments.org/styles/) with `--theme`.
5252
rich loop.py --theme dracula
5353
```
5454

55+
You can set the default theme via the `RICH_THEME` environment variable. So the following is equivalent to the above command:
56+
57+
```
58+
RICH_THEME=dracula rich loop.py
59+
```
60+
5561
![syntax3](https://raw.githubusercontent.com/Textualize/rich-cli/main/imgs/syntax3.png)
5662

5763
By default, `rich` will wrap lines if they don't fit within the available width. You can disable this behavior with `--no-wrap`.
@@ -60,10 +66,10 @@ By default, `rich` will wrap lines if they don't fit within the available width.
6066

6167
## Markdown
6268

63-
You can request markdown rendering by adding the `--markdown` switch or `-m`.
69+
You can request markdown rendering by adding the `--markdown` switch or `-m`. If the file ends with `.md` markdown will be auto-detected.
6470

6571
```
66-
rich README.md -m
72+
rich README.md
6773
```
6874

6975
![markdown1](https://raw.githubusercontent.com/Textualize/rich-cli/main/imgs/markdown1.png)
@@ -76,14 +82,24 @@ rich README.md --hyperlinks
7682

7783
## JSON
7884

79-
You can request JSON pretty formatting and highlighting with the `--json` or `-j` switches.
85+
You can request JSON pretty formatting and highlighting with the `--json` or `-j` switches. If the file ends with `.json` then JSON will be auto-detected.
8086

8187
```
82-
rich cats.json --json
88+
rich cats.json
8389
```
8490

8591
![json1](https://raw.githubusercontent.com/Textualize/rich-cli/main/imgs/json1.png)
8692

93+
## CSV
94+
95+
Rich can display the contents of a CSV (or TSV) as a table. If the file ends with `.csv` or `.tsv` then JSON will be auto-detected.
96+
97+
```
98+
rich deniro.csv
99+
```
100+
101+
![csv1](https://raw.githubusercontent.com/Textualize/rich-cli/main/imgs/csv1.png)
102+
87103
### Rules
88104

89105
You can render a horizontal rule with `--rule` or `-u`. Specify a rule style with `--rule-style`. Set the character(s) to render the line with `--rule-char`.

imgs/csv1.png

236 KB
Loading

poetry.lock

Lines changed: 68 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ rich = "^11.0.0"
2727
click = "^8.0.0"
2828
requests = "^2.0.0"
2929
textual = "^0.1.15"
30+
rich-rst = "^0.2.5"
3031

3132
[tool.poetry.dev-dependencies]
3233
black = "21.12b0"
34+
mypy = "^0.931"
3335

3436
[build-system]
3537
requires = ["poetry-core>=1.0.0"]

0 commit comments

Comments
 (0)