diff --git a/src/main.rs b/src/main.rs index 515734a..c2cfe39 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,18 +26,6 @@ use std::{ use crate::config::Config; -fn cleanup() -> Result<()> { - disable_raw_mode().context("Failed to clean up terminal")?; - execute!(stdout(), LeaveAlternateScreen, DisableMouseCapture) - .context("Failed to clean up terminal")?; - Ok(()) -} - -fn die(e: impl Into) -> T { - eprintln!("{:?}", cleanup().map_or_else(|x| x, |_| e.into())); - exit(1); -} - #[derive(Debug)] enum Command { Quit, @@ -62,6 +50,18 @@ enum Command { JumpUp, } +fn cleanup() -> Result<()> { + disable_raw_mode().context("Failed to clean up terminal")?; + execute!(stdout(), LeaveAlternateScreen, DisableMouseCapture) + .context("Failed to clean up terminal")?; + Ok(()) +} + +fn die(e: impl Into) -> T { + eprintln!("{:?}", cleanup().map_or_else(|x| x, |_| e.into())); + exit(1); +} + #[tokio::main] async fn main() { let res = run().await;