A Github CODEOWNERS answer sheet
Add the following to your Cargo.toml
filter
[dependencies]
codeowners = "0.1"
Typical use involves resolving a CODEOWNERS file, parsing it, then querying target paths
use std::env;
fn main() {
if let (Some(owners_file), Some(path)) =
(env::args().nth(1), env::args().nth(2)) {
let owners = codeowners::from_path(owners_file);
match owners.of(&path) {
None => println!("{} is up for adoption", path),
Some(owners) => {
for owner in owners {
println!("{}", owner);
}
}
}
}
}
Doug Tangren (softprops) 2017-2019