6 ms·
Hi HN, This is a command line tool I’ve been working on for rendering various types of content in the terminal. The core functionality is syntax highlighting
by willm 5y ago
Hi HN,
This is a command line tool I’ve been working on for rendering various types of content in the terminal.
The core functionality is syntax highlighting with line numbers and indent guides.
It can render Markdown (commonmark), and does a reasonable job given the limitations of Terminal emulators.
It can render JSON with syntax highlighting.
Finally it can display general purpose rich text with “console markup” (like bbcode).
All of the above can have borders, styles, alignment applied independently.
This was written hastily, the majority of it came together over a single weekend. This is because it was built with Rich (a Python library which I am also the author of) which does the heavy lifting.
Currently you can install it as a Python package, but I plan on adding it to other channels so you can get it via your preferred package manager.
I know there are some excellent apps with equivalent features but I’m hoping this will become a versatile tool for developers (in particular). I’ll be adding more formats in the future.
Hope you find it interesting. I’ll be around for a while to answer questions.
- simonw 5y agoProgress bar support would be really interesting - providing a neat way to add progress bars to shell scripts that do a bunch of work. Not sure how to go about designing a CLI tool that adds progress bars to things that might involve executing other shell commands though - I guess "pv" is good prior art here.
- willm 5y agoThis is good idea. Will investigate how to pipe data and display a progress bar at the same time.
- pletnes 5y agotqdm already does this. It’s also a python package. https://tqdm.github.io/docs/cli/ https://tqdm.github.io/docs/cli/
- simonw 5y agoThat's awesome - I've used tqdm as a Python library before (mainly within Jupyter notebooks) but I hadn't spotted that CLI version of it.
- pletnes 5y agoCan it render git diffs / git difftool?
- willm 5y agoNope, but that would be a nice addition.
- baggiponte 5y agoHow do you add a new line? I tried $ rich --print "\n hello world" but it just returned \n hello world Also, where can I find the list of emoji and the correspondent ":description:"?
- blooalien 5y agoBro, you are a Python GOD! I been just loving everything about Rich since I discovered it, and your other Python related tools have been fantastic as well. Permanent parts of my "Python toolbox", alongside "Click", "Flask", "Requests", and a bunch of other equally excellent such goodies. Thank you so very much for creating the things you do, (and for publishing them under FOSS licenses).
- stonecharioteer 5y agoI remember when you first shared rich. It was so cool. It's been great watching your output increase so quickly Will. Thanks for all the hard work. Does this support paging? I could see myself using this a lot for markdown files if it does. And do you plan on supporting RST files?
- willm 5y agoPager and RST support is coming :)
- stonecharioteer 5y agoYou da best.
- leonim 5y agoThanks Will for creating Rich. I'm also a big fan of Rich. Are there any plans to make it easy to generate the Rich tables from the command line? Such as from CSV, TSV, JSON/L, or even SQLite databases?