From 7eef73ebdada5bf978557a3a08d7dfe2b9eb417f Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Fri, 9 Aug 2024 16:10:51 -0400 Subject: [PATCH] Update main.rs --- src/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index b91a900..cf94f9d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,6 +13,14 @@ struct Args { /// Keys to extract (can be specified multiple times) #[arg(short, long)] keys: Vec, + + /// Output directory (will be created if it doesn't exist) + #[arg(short, long, default_value = ".")] + output_dir: PathBuf, + + /// Output filename (will be created if it doesn't exist) + #[arg(short, long, default_value = "output.json")] + filename: String, } #[derive(serde::Serialize)] @@ -48,7 +56,8 @@ pub fn main() -> Result<(), Box> { data, }; - let mut file = std::fs::File::create("input.json")?; + let output_file = args.output_dir.join(args.filename); + let mut file = std::fs::File::create(output_file)?; file.write_all(serde_json::to_string_pretty(&witness)?.as_bytes())?; println!("Input file created successfully.");