Crate codeowners [] [src]

Codeowners provides interfaces for resolving owners of paths within code repositories using Github CODEOWNERS files

Examples

Typical use involves resolving a CODEOWNERS file, parsing it, then querying target paths

extern crate codeowners;
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);
          }
       }
     }
  }
}

Structs

Owners

Mappings of owners to path patterns

Enums

Owner

Various types of owners

Functions

from_path

Parse a CODEOWNERS file existing at a given path

from_reader

Parse a CODEOWNERS file from some readable source This format is defined in Github's documentation The syntax is uses gitgnore patterns followed by an identifier for an owner. More information can be found here

locate

Attempts to locate CODEOWNERS file based on common locations relative to a given git repo