Skip to main content

oino_tui/
lib.rs

1//! `oino-tui`: the interactive terminal client over
2//! [`oino_client::SessionBackend`].
3//!
4//! The binary constructs the backend (in-process or remote) and a [`TuiHost`] and calls
5//! [`run`]. Everything visible is driven by [`App`], a pure state machine over key presses,
6//! client events and command replies; [`render::draw`] paints it with ratatui. Extension UI
7//! (dialogs, widgets, status, frames, panels, OUS specs) is rendered natively from the
8//! frontend-agnostic protocol (ui-protocol.md).
9//!
10//! # API map
11//!
12//! | Module | Contents |
13//! |---|---|
14//! | [`app`] | [`App`], [`AppEvent`], [`Effect`], [`TuiOptions`] |
15//! | [`render`] | [`render::draw`] |
16//! | [`host`] | [`TuiHost`], [`host::LocalHost`] |
17//! | [`input`] | crossterm → [`oino_view::keys::KeyId`] |
18//! | [`theme`] | [`theme::Theme`] |
19//! | `runner` | `TUI.start` | terminal lifecycle, event loop, effect execution |
20
21#![forbid(unsafe_code)]
22#![cfg_attr(
23    test,
24    allow(
25        clippy::unwrap_used,
26        clippy::expect_used,
27        clippy::panic,
28        reason = "tests assert by unwrapping"
29    )
30)]
31
32pub mod app;
33pub mod host;
34pub mod input;
35pub mod render;
36mod runner;
37pub mod theme;
38
39pub use app::{App, AppEvent, Effect, Tag, TuiMode, TuiOptions};
40pub use host::TuiHost;
41pub use runner::run;
42
43/// Failure of the interactive client.
44#[derive(Debug, thiserror::Error)]
45#[non_exhaustive]
46pub enum TuiError {
47    /// Terminal I/O failed.
48    #[error("terminal: {0}")]
49    Io(#[from] std::io::Error),
50}