use std::process::{ExitCode, Termination}; use crate::How; pub enum TerminationResult { Ok, Err(How), } impl Termination for TerminationResult { #[inline] fn report(self) -> ExitCode { match self { Self::Ok => ExitCode::SUCCESS, Self::Err(e) => { use std::io::Write; let _ = writeln!( std::io::stderr(), concat!("\n", ansee::styled!(bold, italic, "But, how?"), "\n{}"), e ); ExitCode::FAILURE } } } } impl From> for TerminationResult { #[inline] fn from(value: Result<(), How>) -> Self { match value { Ok(()) => Self::Ok, Err(e) => Self::Err(e), } } }