Skip to main content

Crate rich_cli

Crate rich_cli 

Source
Expand description

rich — a Rust port of the rich-cli terminal toolbox.

The command line lives in this library target so the Python wheel can run it in-process (run and run_embedded are its only public items); main.rs is the rich binary and only calls run.

This binary mirrors the upstream rich-cli command-line tool and is built on the rich library crate. It implements the rendering modes --print, --markdown, --rst, --json, --syntax, --csv, --ipynb, and --rule, plus width/justify, HTML/SVG export to a file (--export-html PATH / -o PATH, --export-svg PATH, which may be combined), the --panel/--padding decorators (with --title/--caption/--style), a plain-file printer (with extension auto-detection), URL fetch (rich <url>, behind the default fetch feature), paging (--pager), and a capability demo — i.e. the whole common rich-cli surface.

On top of that it has documented binary-boundary conveniences that upstream lacks (see docs/PORTING.md): JSONL/log streaming, images and GIFs (behind the default art feature), --watch, --batch, config profiles and --theme-file, and the tool commands inspect, diff (images, text and patches), view, hex, unicode, env, capture, ansi explain, doctor, bench compare, completions, docs, config and plugins; the diagram sources mermaid, dot, deps and schema, chart and profile; the interactive commands (choose, filter, input, confirm, pager, write, file, color, asset, explore); micro; record; and serve (behind the off-by-default serve feature). Each composes public rich / rich-ext / rich-art / rich-diagram / rich-mermaid / rich-interact / rich-micro / rich-record / rich-web APIs.

Functions§

run
Run the rich command line with args (the arguments after the program name) and return its exit status. The rich binary’s main is only this.
run_embedded
run for a host process that is not the rich executable: program is the command that starts this CLI again (for the Python wheel, [sys.executable, "-m", "rs_rich"]), used for --batch workers and the demo’s child --watch, where the binary runs its own executable. An empty program means the current executable, as in run.