1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Error reporting with miette diagnostics.
//!
//! This module provides utilities for displaying facet-args parsing errors
//! with nice graphical diagnostics using miette's report handler.
use ;
use fmt;
/// Initializes the global miette report handler for pretty error output.
///
/// Call this once at the start of your CLI to enable graphical diagnostics
/// for all miette errors throughout the application.
///
/// # Errors
///
/// Returns an error if the miette hook cannot be installed (rare).
///
/// # Examples
///
/// ```no_run
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// textum::cli::report::install_handler()?;
/// // Now all diagnostics will use pretty formatting
/// # Ok(())
/// # }
/// ```
/// A wrapper that formats a miette diagnostic with the graphical report handler.
///
/// This wrapper provides on-demand graphical formatting of diagnostics without
/// requiring a global handler installation. Useful for one-off error displays
/// or testing.
///
/// # Examples
///
/// ```
/// # use textum::cli::report::DiagnosticDisplay;
/// # fn get_error() -> impl miette::Diagnostic { /* ... */ }
/// let err = get_error();
/// eprintln!("{}", DiagnosticDisplay(&err));
/// ```
;