From 5d62329e422d7a73aafe266d9b942d742e274d17 Mon Sep 17 00:00:00 2001 From: nick Date: Sat, 5 Oct 2024 10:36:56 -0400 Subject: [PATCH] reordered construction of logfile and args to fix calling with --help --- src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 17d4225..05a1225 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,6 +25,8 @@ const LOG_FILE: &str = "dirbuilder.log"; const LOG_EXISTS_MSG: &str = "the log file exists, implying dirbuider didn't exit cleanly last time. consult the log and delete it before rerunning."; fn main() -> AnyResult<()> { + let args = Args::parse(); + let target = OpenOptions::new() .write(true) .create_new(true) @@ -35,16 +37,14 @@ fn main() -> AnyResult<()> { let _redirect = Redirect::stderr(target)?; - do_tui()?; + do_tui(args)?; remove_file(LOG_FILE)?; Ok(()) } -fn do_tui() -> Result<(), Error> { - let args = Args::parse(); - +fn do_tui(args: Args) -> Result<(), Error> { let mut terminal = Terminal::new()?; let area = terminal.size()?;