Skip to content

Commit

Permalink
Add verbosity flag
Browse files Browse the repository at this point in the history
Only used to show how long it took to parse a repository
  • Loading branch information
sondr3 committed Oct 18, 2018
1 parent 8be2eca commit 19bb81d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ static CURSES: &str = include_str!("words.txt");
raw(global_settings = "&[AppSettings::ColoredHelp]")
)]
struct Cli {
#[structopt(short = "v", long = "verbose")]
verbose: bool,
#[structopt(
name = "directory",
help = "Directory to parse commits",
Expand Down Expand Up @@ -111,10 +113,12 @@ impl Author {
fn main() -> Result<(), Box<Error>> {
let start = Instant::now();
let curses: HashSet<&str> = CURSES.lines().collect();
let path = match Cli::from_args().directory {
let opt = Cli::from_args();
let path = match opt.directory {
Some(directory) => directory,
None => env::current_dir()?,
};
let verbose = opt.verbose;
let repo = Repository::open(&path)?;
let mut revwalk = repo.revwalk()?;
let mut commits: Vec<Commit> = Vec::new();
Expand Down Expand Up @@ -147,7 +151,9 @@ fn main() -> Result<(), Box<Error>> {
}
}
let end = Instant::now();
println!("{:?}", end.duration_since(start));
if verbose {
println!("Took {:?} to parse {}", end.duration_since(start), repo.name);
}
println!("{}", repo);
for mut author in repo.authors.values() {
if author.is_naughty() {
Expand Down

0 comments on commit 19bb81d

Please sign in to comment.