printwell_cli/cli/utils/
output.rs1use std::fmt::Display;
8use std::path::Path;
9
10#[macro_export]
14macro_rules! status {
15 ($($arg:tt)*) => {
16 eprintln!($($arg)*)
17 };
18}
19
20#[allow(dead_code)]
22pub fn file_written(path: impl AsRef<Path>) {
23 eprintln!("Written to: {}", path.as_ref().display());
24}
25
26#[allow(dead_code)]
28pub fn file_written_desc(desc: impl Display, path: impl AsRef<Path>) {
29 eprintln!("{desc} written to: {}", path.as_ref().display());
30}
31
32pub fn note(msg: impl Display) {
34 eprintln!("{msg}");
35}
36
37#[allow(dead_code)]
39pub fn blank() {
40 eprintln!();
41}
42
43pub fn batch_ok(input: &str, output: impl AsRef<Path>, pages: u32) {
45 eprintln!(
46 " [OK] {} -> {} ({} pages)",
47 input,
48 output.as_ref().display(),
49 pages
50 );
51}
52
53pub fn batch_fail(input: &str, error: impl Display) {
55 eprintln!(" [FAIL] {input} - {error}");
56}
57
58pub fn batch_summary(success: usize, failed: usize, elapsed_secs: f64) {
60 eprintln!("\nBatch conversion complete:");
61 eprintln!(" Success: {success}");
62 eprintln!(" Failed: {failed}");
63 eprintln!(" Time: {elapsed_secs:.2}s");
64}
65
66#[allow(dead_code)]
68pub fn validation_counts(errors: usize, warnings: usize, infos: usize) {
69 eprintln!("Found {errors} errors, {warnings} warnings, {infos} info messages");
70}
71
72#[allow(dead_code)]
74pub fn validation_issue(prefix: &str, category: impl Display, description: impl Display) {
75 eprintln!("{prefix} [{category}] {description}");
76}
77
78#[allow(dead_code)]
80pub fn validation_clause(clause: &str) {
81 eprintln!(" Clause: {clause}");
82}
83
84#[allow(dead_code)]
86pub fn validation_suggestion(suggestion: &str) {
87 eprintln!(" Suggestion: {suggestion}");
88}
89
90#[allow(dead_code)]
92pub fn validation_page(page: u32) {
93 eprintln!(" Page: {page}");
94}
95
96#[allow(dead_code)]
98pub fn validation_result(is_compliant: bool, level: impl Display) {
99 if is_compliant {
100 eprintln!("Result: COMPLIANT with {level}");
101 } else {
102 eprintln!("Result: NOT COMPLIANT with {level}");
103 }
104}