Skip to content

Commit

Permalink
add cargo example / util to parse a given pyreport into sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-codecov committed Apr 25, 2024
1 parent b477212 commit 8467210
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions examples/parse_pyreport.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use std::{env, fs::File, path::PathBuf};

use codecov_rs::parsers::pyreport_shim::parse_pyreport;

fn usage_error() -> ! {
println!("Usage:");
println!(" cargo run --example parse_pyreport -- [REPORT_JSON_PATH] [CHUNKS_PATH] [OUT_PATH]");

std::process::exit(1);
}

pub fn main() -> Result<(), std::io::Error> {
let args: Vec<String> = env::args().collect();

if args.len() != 4 {
usage_error();
}


let report_json_file = File::open(&args[1])?;
let chunks_file = File::open(&args[2])?;
let out_path = PathBuf::from(&args[3]);

parse_pyreport(&report_json_file, &chunks_file, out_path)?;

Ok(())
}

0 comments on commit 8467210

Please sign in to comment.