Module ui

Module ui 

Source
Expand description

Terminal UI utilities for progress bars and formatted output.

This module provides a clean API for displaying build progress, status messages, and formatted output in the terminal. It handles environment detection (CI, TTY) and gracefully degrades when terminal features aren’t available.

§Examples

use fob_cli::ui;
use std::time::Duration;

// Initialize color support
ui::init_colors();

// Show progress for multi-step operations
let mut progress = ui::BundleProgress::new(3);
let task = progress.add_task("Building modules");
progress.finish_task(task, "Built 5 modules");
progress.finish("Build complete!");

// Simple spinner for quick tasks
let spinner = ui::Spinner::new("Loading config...");
spinner.finish("Config loaded");

// Status messages
ui::success("Build successful");
ui::error("Failed to parse file");

Structs§

BundleProgress
Progress tracker for bundling operations.
Spinner
Simple spinner for tasks without known duration.

Functions§

debug
Print a debug message to stderr (only if RUST_LOG is set).
error
Print an error message to stderr.
format_duration
Format duration in human-readable format.
format_size
Format file size in human-readable format.
info
Print an info message to stderr.
init_colors
Initialize color support based on environment.
is_ci
Check if running in a CI environment.
print_build_summary
Print a build summary table to stderr.
should_use_color
Check if color output should be enabled.
success
Print a success message to stderr.
warning
Print a warning message to stderr.