reordered construction of logfile and args to fix calling with --help

main
nick 2024-10-05 10:36:56 -04:00
parent b56ee8ffa5
commit 5d62329e42
1 changed files with 4 additions and 4 deletions

View File

@ -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()?;