Skip to main content

theater_cli/utils/
formatting.rs

1use console::style;
2
3/// Format a section header
4pub fn format_section(title: &str) -> String {
5    format!(
6        "\n{}\n{}",
7        style(title).bold().underlined(),
8        style("─".repeat(title.len())).dim()
9    )
10}
11
12/// Format a key-value pair for display
13pub fn format_key_value(key: &str, value: &str) -> String {
14    format!("{}: {}", style(key).bold(), value)
15}
16
17/// Format a success message
18pub fn format_success(message: &str) -> String {
19    format!("{} {}", style("✓").green().bold(), message)
20}
21
22/// Format an error message
23pub fn format_error(message: &str) -> String {
24    format!("{} {}", style("✗").red().bold(), message)
25}
26
27/// Format an info message
28pub fn format_info(message: &str) -> String {
29    format!("{} {}", style("ℹ").blue().bold(), message)
30}
31
32/// Format a warning message
33pub fn format_warning(message: &str) -> String {
34    format!("{} {}", style("⚠").yellow().bold(), message)
35}