Expand description
Table formatting utilities for displaying structured CLI output.
This module provides specialized table formatting capabilities for displaying various types of structured data in the SubX CLI. It focuses primarily on match operation results but can be extended for other tabular data needs.
§Features
- Match Results Display: Formatted tables for AI matching operations
- Consistent Styling: Rounded borders and aligned columns
- Internationalization: Support for Chinese column headers
- Flexible Layout: Automatic column width adjustment
§Table Styling
All tables use a consistent rounded border style with left-aligned content for optimal readability. The styling is designed to work well in both light and dark terminal themes.
§Examples
use subx_cli::cli::table::{MatchDisplayRow, create_match_table};
// Each match result is split into multiple lines for display: video, subtitle and new name
let rows = vec![
MatchDisplayRow {
file_type: "Video 1".to_string(),
file_path: "movie.mp4".to_string(),
},
MatchDisplayRow {
file_type: "Subtitle 1".to_string(),
file_path: "subtitle.srt".to_string(),
},
MatchDisplayRow {
file_type: "New name 1".to_string(),
file_path: "movie.srt".to_string(),
},
];
let table = create_match_table(rows);
println!("{}", table);Structs§
- Match
Display Row - Display row structure for file matching operation results.
Functions§
- create_
match_ table - Create a formatted table string from match operation results.