reflex/
output.rs

1//! User-facing output utilities for clean, colored terminal messages
2//!
3//! This module provides functions for displaying warnings and errors to users
4//! in a friendly, colored format without internal logging noise (timestamps,
5//! log levels, crate names, etc.).
6
7use owo_colors::OwoColorize;
8
9/// Display a warning message to the user in yellow with padding
10///
11/// Format: blank line + yellow message + blank line
12///
13/// # Example
14/// ```ignore
15/// output::warn("Pattern matched 4951 files - parsing may take some time.");
16/// ```
17pub fn warn(message: &str) {
18    eprintln!("\n{}\n", message.yellow());
19}
20
21/// Display an error message to the user in red with padding
22///
23/// Format: blank line + red message + blank line
24///
25/// # Example
26/// ```ignore
27/// output::error("Index not found. Run 'rfx index' to build the cache first.");
28/// ```
29pub fn error(message: &str) {
30    eprintln!("\n{}\n", message.red());
31}
32
33/// Display an informational message to the user in default color with padding
34///
35/// Format: blank line + message + blank line
36///
37/// # Example
38/// ```ignore
39/// output::info("Indexing completed successfully.");
40/// ```
41pub fn info(message: &str) {
42    eprintln!("\n{}\n", message);
43}