reordered construction of logfile and args to fix calling with --help
parent
b56ee8ffa5
commit
5d62329e42
|
@ -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.";
|
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<()> {
|
fn main() -> AnyResult<()> {
|
||||||
|
let args = Args::parse();
|
||||||
|
|
||||||
let target = OpenOptions::new()
|
let target = OpenOptions::new()
|
||||||
.write(true)
|
.write(true)
|
||||||
.create_new(true)
|
.create_new(true)
|
||||||
|
@ -35,16 +37,14 @@ fn main() -> AnyResult<()> {
|
||||||
|
|
||||||
let _redirect = Redirect::stderr(target)?;
|
let _redirect = Redirect::stderr(target)?;
|
||||||
|
|
||||||
do_tui()?;
|
do_tui(args)?;
|
||||||
|
|
||||||
remove_file(LOG_FILE)?;
|
remove_file(LOG_FILE)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_tui() -> Result<(), Error> {
|
fn do_tui(args: Args) -> Result<(), Error> {
|
||||||
let args = Args::parse();
|
|
||||||
|
|
||||||
let mut terminal = Terminal::new()?;
|
let mut terminal = Terminal::new()?;
|
||||||
let area = terminal.size()?;
|
let area = terminal.size()?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue