Skip to main content

git_workflow/output/
style.rs

1//! Styled console output utilities
2
3/// ANSI color codes
4const RED: &str = "\x1b[0;31m";
5const GREEN: &str = "\x1b[0;32m";
6const YELLOW: &str = "\x1b[0;33m";
7const BLUE: &str = "\x1b[0;34m";
8const BOLD: &str = "\x1b[1m";
9const RESET: &str = "\x1b[0m";
10
11/// Output helper for informational messages (ℹ)
12pub fn info(msg: &str) {
13    println!("{BLUE}ℹ{RESET} {msg}");
14}
15
16/// Output helper for success messages (✓)
17pub fn success(msg: &str) {
18    println!("{GREEN}✓{RESET} {msg}");
19}
20
21/// Output helper for warning messages (⚠)
22pub fn warn(msg: &str) {
23    println!("{YELLOW}⚠{RESET} {msg}");
24}
25
26/// Output helper for error messages (✗)
27pub fn error(msg: &str) {
28    eprintln!("{RED}✗{RESET} {msg}");
29}
30
31/// Output helper for action/suggestion messages (→)
32pub fn action(msg: &str) {
33    println!("{BOLD}→{RESET} {msg}");
34}
35
36/// Format text as bold
37pub fn bold(text: &str) -> String {
38    format!("{BOLD}{text}{RESET}")
39}
40
41/// Print a horizontal separator
42pub fn separator() {
43    println!("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
44}
45
46/// Print the "Ready" header with branch name
47pub fn ready(message: &str, branch: &str) {
48    println!();
49    separator();
50    println!("{GREEN}{BOLD}{message}{RESET} on {BOLD}{branch}{RESET}");
51}
52
53/// Print hints for next actions
54pub fn hints(lines: &[&str]) {
55    println!();
56    println!("{BOLD}Next:{RESET}");
57    for line in lines {
58        println!("  {line}");
59    }
60}