Skip to main content

Module tui

Module tui 

Source
Expand description

Terminal UI for build progress visualization

This module provides a Ratatui-based TUI for displaying build progress, as well as a plain logger for CI/non-interactive environments.

§Architecture

The TUI is event-driven and communicates with the build process via channels:

┌─────────────────┐     mpsc::Sender<BuildEvent>     ┌─────────────────┐
│  Build Process  │ ──────────────────────────────▶ │    BuildTui     │
└─────────────────┘                                  └─────────────────┘

§Example

use zlayer_builder::tui::{BuildTui, BuildEvent};
use std::sync::mpsc;

// Create channel for build events
let (tx, rx) = mpsc::channel();

// Spawn build process that sends events
std::thread::spawn(move || {
    tx.send(BuildEvent::StageStarted {
        index: 0,
        name: Some("builder".to_string()),
        base_image: "node:20-alpine".to_string(),
    }).unwrap();
    // ... more events ...
});

// Run TUI (blocks until build completes or user quits)
let mut tui = BuildTui::new(rx);
tui.run()?;

Structs§

BuildState
Internal build state tracking
BuildTui
Main TUI application for build progress visualization
BuildView
Main build progress view widget
InstructionState
State of a single instruction
OutputLine
A single line of build output, tagged as stdout or stderr.
PlainLogger
Simple logging output for CI/non-interactive mode
StageState
State of a single build stage

Enums§

BuildEvent
Build event for TUI updates
InstructionStatus
Status of an instruction during build