Skip to content

Commit

Permalink
feat: make output dir for reports
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Jan 14, 2021
1 parent 6832a25 commit 43e9ee6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/bin/coco.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use coco::app::git_app::get_repo;
use coco::domain::config::CocoConfig;
use coco::infrastructure::name_format;
use std::fs;
use std::path::Path;

fn main() {
let matches = App::new("Coco Program")
Expand All @@ -27,6 +28,12 @@ fn main() {
let results = get_repo(x.url.as_str());
let file_name = name_format::from_url(x.url.as_str());

fs::write(file_name, results).expect("cannot write file");
let root = Path::new(".coco");
let reporter_buf = root.join("reporter");
let _ = fs::create_dir_all(reporter_buf.clone());

let output_file = reporter_buf.join(file_name);

fs::write(output_file, results).expect("cannot write file");
}
}

0 comments on commit 43e9ee6

Please sign in to comment.