claude_priority/
output.rs1use colored::*;
2use crate::models::{ValidationResult, ValidationSummary};
3
4pub fn print_banner() {
5 println!();
6 println!("╔══════════════════════════════════════════════════╗");
7 println!("║ Claude Priority Validator ║");
8 println!("║ Ensuring marketplace compliance ║");
9 println!("╚══════════════════════════════════════════════════╝");
10 println!();
11}
12
13pub fn print_error(message: &str) {
14 println!("{} {}", "❌".red(), message);
15}
16
17pub fn print_warning(message: &str) {
18 println!("{} {}", "⚠️ ".yellow(), message);
19}
20
21pub fn print_success(message: &str) {
22 println!("{} {}", "✅".green(), message);
23}
24
25pub fn print_info(message: &str) {
26 println!("{} {}", "ℹ️ ".blue(), message);
27}
28
29pub fn print_validation_result(result: &ValidationResult) {
30 println!();
31 print_info(&format!("Checking {}...", result.check_type));
32
33 for error in &result.errors {
35 print_error(error);
36 }
37
38 for warning in &result.warnings {
40 print_warning(warning);
41 }
42
43 if result.passed {
45 print_success(&format!("{}: PASSED", result.check_type));
46 } else {
47 print_error(&format!("{}: FAILED ({} errors)",
48 result.check_type, result.error_count()));
49 }
50 println!();
51}
52
53pub fn print_summary(summary: &ValidationSummary) {
54 println!("══════════════════════════════════════════════════");
55 println!("Validation Summary");
56 println!("══════════════════════════════════════════════════");
57 println!("Total checks: {}", summary.total_checks);
58 println!("Passed: {}", summary.passed_checks.to_string().green());
59 println!("Failed: {}", summary.failed_checks.to_string().red());
60 println!("══════════════════════════════════════════════════");
61 println!();
62
63 if summary.is_success() {
64 print_success("All validation checks passed! 🎉");
65 println!();
66 } else {
67 print_error(&format!("Validation failed with {} failed checks", summary.failed_checks));
68 println!();
69 }
70}
71
72#[cfg(test)]
73mod tests {
74 use super::*;
75 use crate::models::CheckType;
76
77 #[test]
78 fn test_print_validation_result() {
79 let mut result = ValidationResult::new(CheckType::Naming);
80 result.add_error("Test error".to_string());
81 result.add_warning("Test warning".to_string());
82
83 print_validation_result(&result);
85 }
86}