Skip to main content

rtb_tui/
lib.rs

1//! Reusable TUI building blocks for RTB-built CLI tools.
2//!
3//! Three pieces:
4//!
5//! - [`Wizard`] / [`WizardStep`] — multi-step interactive form with
6//!   escape-to-back navigation, backed by [`inquire`].
7//! - [`render_table`] / [`render_json`] — uniform structured-output
8//!   helpers used by the v0.4 `rtb-cli` ops subtrees behind a global
9//!   `--output text|json` flag.
10//! - [`Spinner`] — TTY-aware progress indicator that no-ops when
11//!   stderr isn't a terminal (CI logs, MCP transports).
12//!
13//! The original design contract is [spec 0020] on the rust-tool-base
14//! wiki.
15//!
16//! [spec 0020]: https://gitlab.com/phpboyscout/rust-tool-base/-/wikis/specs/0020-rtb-tui-v0.1
17
18#![forbid(unsafe_code)]
19
20mod error;
21mod render;
22mod spinner;
23mod wizard;
24
25pub use error::{RenderError, WizardError};
26pub use render::{render_json, render_table};
27pub use spinner::Spinner;
28pub use wizard::{StepOutcome, Wizard, WizardBuilder, WizardStep};
29
30/// Re-export so downstream consumers (and `WizardStep` impls) can
31/// `?`-propagate without adding `inquire` as a direct dependency.
32pub use inquire::InquireError;
33
34/// Re-export so a `render_table` row type derives the same `Tabled` this
35/// crate bounds on. A second `tabled` version in the graph is a separate,
36/// incompatible trait; derive with `#[tabled(crate = "rtb_tui::tabled")]`.
37pub use tabled;