rs_rich.cli¶
Generated from the type stubs by scripts/gen_python_api.py; do not edit.
The rich command line, from Python.
python -m rs_rich ARGS and the rich-rs ARGS console script run the
same command line as the rich binary built from this repository (the
Rust port of rich-cli), in-process: output, errors and exit codes are the
binary's, byte for byte. The console script is rich-rs because rich
belongs to rich-cli.
:func:main with no arguments is that entry point. With an explicit
argv it is the call for a running program, and runs the command line in
a child python -m rs_rich process: see :func:main.
main ¶
Run the rich command line and return its exit status.
With argv=None (python -m rs_rich and rich-rs) the arguments
are sys.argv[1:] and the command line runs in this process with the
GIL released, as the program itself: it writes to file descriptors 1 and
2, reads file descriptor 0, and Ctrl-C ends it as it ends the binary.
With an explicit argv (a list of argument strings, without the
program name) the command line runs in a child python -m rs_rich
process that shares this one's standard streams. The command line keeps
process-wide state no library call should leave behind: its --batch,
--watch and demo modes install a Ctrl-C handler that replaces
Python's and can be installed only once per process (and a config file
can turn those modes on without any flag), and a few error paths end the
process. The output and exit status are the same either way.