Create output directory if it doesn't exist

This commit is contained in:
a2x 2024-03-17 09:40:17 +10:00
parent 715bf64ad3
commit f3a4d0e758
1 changed files with 4 additions and 1 deletions

View File

@ -1,3 +1,4 @@
use std::fs;
use std::path::PathBuf;
use anyhow::Result;
@ -73,7 +74,7 @@ fn parse_args() -> ArgMatches {
.help("The output directory to write the generated files to.")
.long("output")
.short('o')
.default_value("output"),
.default_value("generated"),
)
.get_matches()
}
@ -112,5 +113,7 @@ fn extract_args(matches: &ArgMatches) -> Result<(Option<String>, ConnectorArgs,
.map(PathBuf::from)
.unwrap();
fs::create_dir_all(&output_path)?;
Ok((conn_name, conn_args, output_path))
}