Skip to content

Instantly share code, notes, and snippets.

@eeeeeta
Last active January 2, 2017 13:11
Show Gist options
  • Save eeeeeta/192290819e693c455eb8e256e6294f1e to your computer and use it in GitHub Desktop.
Save eeeeeta/192290819e693c455eb8e256e6294f1e to your computer and use it in GitHub Desktop.
Generates the "This week's commit log" section of SQA devlog updates
/* Generates the "This week's commit log" section */
use std::env;
use std::process::Command;
struct Project {
name: &'static str,
path: &'static str
}
fn main() {
let week: usize = env::args().nth(1).expect("expected one argument").parse().expect("argument must be a number");
let projects = vec![
Project {
name: "sqa-jack",
path: "/home/eeeeeta/sqa-jack"
},
Project {
name: "sqa-engine",
path: "/home/eeeeeta/sqa-ng"
}
];
println!("## This week's commit log\n");
for project in projects {
println!("### `{}`\n", project.name);
Command::new("git")
.arg("--no-pager")
.arg("log")
.arg(&format!("--pretty=format:* [**%h**](https://github.com/eeeeeta/{}/commit/%h) *on %ad*: %s", project.name))
.arg("--date=short")
.arg(&format!("week-{}..week-{}", week-1, week))
.current_dir(project.path)
.status()
.expect("failed to execute git");
println!("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment