rich-click-rs
Rich help formatting for click-rs, powered by
rich-rs, a Rust port of Python's
rich-click.
This crate provides rich-styled help output (usage, panels, option tables, and command tables) that mirrors the Python rich-click experience, but for Rust.
Attribution. rich-click-rs is a derivative work: a Rust port of rich-click by Phil Ewels and contributors, which itself builds on Click and Rich. All credit for the original design goes to their authors.
Installing
[]
= "1.0"
This pulls in click-rs and rich-rs transitively. Note the click library is imported as
click even though its crate is named click-rs.
Quick Start
use Command;
use ;
Macros
For a tiny main.rs, use macros:
use rich_main_with_errors;
Themes
List available themes:
Set a theme via env var (matches Python rich-click):
RICH_CLICK_THEME=solarized
Optional Enhancements (Off by Default)
These are optional helpers that go beyond Python rich-click parity. All are disabled by default.
- Prompt metadata in help output:
- Enable
show_prompt = true. - Customize
prompt_string,prompt_confirm_string,prompt_hidden_string,prompt_confirm_hidden_string. - If you want full ordering control, add
"prompt"tooptions_table_help_sections.
- Enable
- Parameter source in errors:
- Enable
errors_show_param_source = true. - Customize
errors_param_source_format(use{}for the source label).
- Enable
- Rich test runner:
- Use
RichCliRunnerto capture rich help and rich errors when testing.
- Use
use Command;
use ;
let cmd = new
.option
.build;
let config = builder
.build;
let result = new
.config
.invoke;
Status
Feature-parity with Python rich-click for core help rendering, with parity tests and example suite comparisons in place. Optional enhancements (off by default) are available for prompt metadata in help output, error parameter-source hints, and a rich-aware test runner.