Allow for multiple root-dir args

master
Wynd 2025-01-12 12:24:54 +02:00
parent de2b6190d5
commit fd7e8c2e88
2 changed files with 5 additions and 3 deletions

View File

@ -9,7 +9,7 @@ use crate::heatmap::{ColorLogic, Format, HeatmapColors};
#[command(version, about, author, long_about = None, args_override_self = true)]
pub struct CliArgs {
#[arg(long("root-dir"), value_hint = ValueHint::DirPath)]
pub root_dir: Option<PathBuf>,
pub root_dir: Option<Vec<PathBuf>>,
#[arg(short, long, num_args(0..))]
pub authors: Option<Vec<String>>,

View File

@ -196,9 +196,11 @@ fn get_commits(
let ignored_repos = args.ignored_repos.as_ref().unwrap_or(&vec![]).to_owned();
let (repos, branches) = match &args.root_dir {
Some(root) => {
Some(roots) => {
let mut repos: Vec<PathBuf> = vec![];
find_git_repos(root, &mut repos, &ignored_repos, &args);
for root in roots {
find_git_repos(root, &mut repos, &ignored_repos, &args);
}
let branches = vec!["".to_string(); repos.len()];
(repos, branches)
}