Expand description
User interface utilities and display helpers for SubX CLI.
This module provides a comprehensive set of utilities for creating consistent and user-friendly command-line interfaces. It handles status messages, progress indicators, result displays, and AI usage statistics with consistent styling and formatting.
§Features
- Status Messages: Success, error, and warning message formatting
- Progress Indicators: Configurable progress bars for long operations
- Result Display: Formatted tables and structured output
- AI Statistics: Usage tracking and cost information display
- Consistent Styling: Color-coded messages with Unicode symbols
§Design Principles
- Accessibility: Clear visual hierarchy with color and symbols
- Configurability: Respects user preferences for progress display
- Consistency: Unified styling across all CLI operations
- Informativeness: Rich context and actionable information
§Examples
use subx_cli::cli::ui;
// Display status messages
ui::print_success("Subtitle files processed successfully");
ui::print_warning("File format might be incompatible");
ui::print_error("Unable to read configuration file");
// Create progress bar for batch operations
let progress = ui::create_progress_bar(100);
for i in 0..100 {
progress.inc(1);
// ... processing ...
}
progress.finish_with_message("Processing completed");
Functions§
- create_
progress_ bar - Create a progress bar with consistent styling and configuration.
- display_
ai_ usage - Display comprehensive AI API usage statistics and cost information.
- display_
match_ results - Display file matching results with support for dry-run preview mode.
- print_
error - Display an error message with consistent formatting.
- print_
success - Display a success message with consistent formatting.
- print_
warning - Display a warning message with consistent formatting.