Skip to main content

Module ui

Module ui 

Source
Expand description

Rendering, theming, and structured output helpers. The UI module exists to turn structured output into predictable terminal text, while keeping rendering decisions separate from business logic.

The UI stack has three layers:

  • format lowers rows and semantic outputs into a structured crate::ui::Document.
  • the internal renderer turns that document into terminal text using resolved width, color, unicode, and theme settings.
  • inline/theme/style helpers provide smaller reusable building blocks for prompts, messages, and rich text fragments.

Keep the distinction between “document shaping” and “terminal rendering” clear. Most bugs become easier to localize once you know which side of that boundary is wrong.

Contract:

  • UI code may depend on structured output and render settings
  • it should not own config precedence, command execution, or provider I/O
  • terminal styling decisions should stay here rather than leaking into the rest of the app

Public API shape:

Re-exports§

pub use chrome::RuledSectionPolicy;
pub use chrome::SectionFrameStyle;
pub use chrome::SectionRenderContext;
pub use chrome::SectionStyleTokens;
pub use chrome::render_section_block_with_overrides;
pub use chrome::render_section_divider_with_overrides;
pub use clipboard::ClipboardError;
pub use clipboard::ClipboardService;
pub use document::Block;
pub use document::CodeBlock;
pub use document::Document;
pub use document::JsonBlock;
pub use document::LineBlock;
pub use document::LinePart;
pub use document::MregBlock;
pub use document::MregEntry;
pub use document::MregRow;
pub use document::MregValue;
pub use document::PanelBlock;
pub use document::PanelRules;
pub use document::TableAlign;
pub use document::TableBlock;
pub use document::TableStyle;
pub use document::ValueBlock;
pub use inline::line_from_inline;
pub use inline::parts_from_inline;
pub use inline::render_inline;
pub use interactive::Interactive;
pub use interactive::InteractiveResult;
pub use interactive::InteractiveRuntime;
pub use interactive::Spinner;
pub use messages::GroupedRenderOptions;
pub use messages::MessageBuffer;
pub use messages::MessageLayout;
pub use messages::MessageLevel;
pub use messages::UiMessage;
pub use messages::adjust_verbosity;
pub use style::StyleOverrides;
pub use style::StyleToken;
pub use theme::DEFAULT_THEME_NAME;
pub use theme::ThemeDefinition;
pub use theme::ThemeOverrides;
pub use theme::ThemePalette;
pub use theme::all_themes;
pub use theme::available_theme_names;
pub use theme::builtin_themes;
pub use theme::display_name_from_id;
pub use theme::find_builtin_theme;
pub use theme::find_theme;
pub use theme::is_known_theme;
pub use theme::normalize_theme_name;
pub use theme::resolve_theme;

Modules§

chrome
Reusable section chrome helpers for messages, help, and guide rendering.
clipboard
Clipboard integration helpers for copy-safe output flows.
document
Structured display blocks used as the boundary between formatting and terminal rendering.
inline
Lightweight inline-markup parsing and rendering helpers.
interactive
Interactive terminal helpers for prompts and transient status UI.
messages
Buffered user-facing messages and their rendering helpers.
style
Semantic style tokens and explicit style overrides layered over the theme.
theme
Built-in theme definitions and theme lookup helpers.

Structs§

HelpChromeSettings
User-configurable settings for rendering CLI output.
RenderRuntime
Runtime terminal characteristics used when resolving render behavior.
RenderRuntimeBuilder
Builder for RenderRuntime.
RenderSettings
User-configurable settings for rendering CLI output.
RenderSettingsBuilder
Builder for RenderSettings.
ResolvedRenderSettings
Fully resolved rendering settings used by the document renderer.

Enums§

GuideDefaultFormat
Default output format to use when guide rendering is not explicitly requested.
HelpTableChrome
Border style override for help tables.
RenderBackend
Rendering backend selected for the current output pass.
TableBorderStyle
Border style applied to rendered tables.
TableOverflow
Overflow strategy for table cell content.

Functions§

copy_output_to_clipboard
Copies rendered output to the configured clipboard service.
copy_rows_to_clipboard
Copies rendered rows to the configured clipboard service.
render_document
Renders a document directly with the resolved UI settings.
render_document_for_copy
Renders a document in plain copy-safe form.
render_output
Renders a structured output result using the configured output format.
render_output_for_copy
Renders an output result in plain copy-safe form.
render_rows
Renders rows using the configured output format.
render_rows_for_copy
Renders rows in plain copy-safe form.