diff --git a/crates/cairo-coverage/src/cli.rs b/crates/cairo-coverage/src/cli.rs index 65e3aae..8a573df 100644 --- a/crates/cairo-coverage/src/cli.rs +++ b/crates/cairo-coverage/src/cli.rs @@ -2,14 +2,16 @@ use anyhow::{ensure, Result}; use camino::Utf8PathBuf; use clap::Parser; +pub const DEFAULT_OUTPUT_NAME: &str = "coverage"; + #[derive(Parser, Debug)] #[command(version)] pub struct Cli { - /// Path to the .json file with trace data. - #[arg(value_parser = parse_trace_file)] - pub trace_file: Utf8PathBuf, + /// Paths to the .json files with trace data. + #[arg(value_parser = parse_trace_file, num_args = 1..)] + pub trace_files: Vec, - /// Path to the output file. [default: `.lcov`] + /// Path to the output file. [default: `coverage.lcov`] #[arg(short, long)] pub output_path: Option, } diff --git a/crates/cairo-coverage/src/main.rs b/crates/cairo-coverage/src/main.rs index 35e865e..a238738 100644 --- a/crates/cairo-coverage/src/main.rs +++ b/crates/cairo-coverage/src/main.rs @@ -1,5 +1,6 @@ mod cli; +use crate::cli::DEFAULT_OUTPUT_NAME; use anyhow::{Context, Result}; use clap::Parser; use cli::Cli; @@ -9,10 +10,9 @@ use std::io::Write; fn main() -> Result<()> { let cli = Cli::parse(); - let output_path = cli.output_path.unwrap_or_else(|| { - let output_file_name = cli.trace_file.file_stem().unwrap(); // Safe to unwrap since we checked that the file exists - format!("./{output_file_name}.lcov").into() - }); + let output_path = cli + .output_path + .unwrap_or_else(|| format!("./{DEFAULT_OUTPUT_NAME}.lcov").into()); File::create(&output_path) .context(format!(