-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsql_to_pyreport.rs
More file actions
38 lines (29 loc) · 923 Bytes
/
sql_to_pyreport.rs
File metadata and controls
38 lines (29 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use std::env;
use std::fs::File;
use codecov_rs::error::Result;
use codecov_rs::report::pyreport::ToPyreport;
use codecov_rs::report::SqliteReport;
fn usage_error() -> ! {
println!("Usage:");
println!(
" cargo run --example parse_pyreport -- [SQLITE_PATH] [REPORT_JSON_PATH] [CHUNKS_PATH]"
);
println!();
println!("Example:");
println!(
" cargo run --example parse_pyreport -- d2a9ba1.sqlite ~/report_json.json ~/chunks.txt"
);
std::process::exit(1);
}
pub fn main() -> Result<()> {
let args: Vec<String> = env::args().collect();
if args.len() != 4 {
usage_error();
}
let sqlite_path = &args[1];
let report = SqliteReport::open(sqlite_path.into())?;
let mut report_json_file = File::create(&args[2])?;
let mut chunks_file = File::create(&args[3])?;
report.to_pyreport(&mut report_json_file, &mut chunks_file)?;
Ok(())
}