| 201 | } |
| 202 | |
| 203 | fn format_error(filename: Option<&str>, error: impl fmt::Display) { |
| 204 | let mut buffer = String::with_capacity(128); |
| 205 | if let Some(filename) = filename { |
| 206 | writeln!(buffer, "Filename: {filename}").expect("Failed to write to buffer"); |
| 207 | } |
| 208 | buffer.push_str("Status: ERROR\n"); |
| 209 | writeln!(buffer, "Details: {error}").expect("Failed to write to buffer"); |
| 210 | eprintln!("{}", buffer.trim()); |
| 211 | } |
| 212 | |
| 213 | const VERSION_MESSAGE: &[u8] = |
| 214 | concat!("css-inline ", env!("CARGO_PKG_VERSION"), "\n").as_bytes(); |