feat: add report flag to CLI

This commit is contained in:
ThetaDev 2023-08-03 20:49:30 +02:00
parent e5c51fe995
commit 57086cab9a

View file

@ -19,6 +19,9 @@ use serde::Serialize;
struct Cli { struct Cli {
#[clap(subcommand)] #[clap(subcommand)]
command: Commands, command: Commands,
/// Always generate a report (used for debugging)
#[clap(long)]
report: bool,
} }
#[derive(Subcommand)] #[derive(Subcommand)]
@ -392,10 +395,11 @@ async fn main() {
storage_dir.push("rustypipe"); storage_dir.push("rustypipe");
_ = std::fs::create_dir(&storage_dir); _ = std::fs::create_dir(&storage_dir);
let rp = RustyPipe::builder() let mut rp = RustyPipe::builder().storage_dir(storage_dir);
.storage_dir(storage_dir) if cli.report {
.build() rp = rp.report();
.unwrap(); }
let rp = rp.build().unwrap();
match cli.command { match cli.command {
Commands::Download { Commands::Download {