Compare commits
No commits in common. "c2466abf836b989bff8a4aadf931d39bbbec68c9" and "249a9624417ba8591dbb1a4d1f66b72a7092210b" have entirely different histories.
c2466abf83
...
249a962441
|
@ -1,6 +1,6 @@
|
|||
# git-heatmap
|
||||
|
||||
simple but customizable heatmap for your **local** git repos written in Rust.
|
||||
simple but customizable heatmap for your local git repos written in Rust.
|
||||
|
||||
![screenshot](screenshot.png)
|
||||
|
||||
|
@ -47,9 +47,6 @@ $ git-heatmap -r "/path/to/repo" -b "main" -r "other/repo" -b ""
|
|||
# which branches should be checked per repo, in this case all branches will be checked.
|
||||
$ git-heatmap --root-dir "/path"
|
||||
|
||||
# when using the --root-dir option you can also ignore folders of repos you don't want to count
|
||||
$ git-heatmap --root-dir "/path" -i "project"
|
||||
|
||||
# by default merges are counted so using --no-merges ensures they won't be counted
|
||||
$ git-heatmap --no-merges
|
||||
|
||||
|
|
|
@ -23,9 +23,6 @@ pub struct CliArgs {
|
|||
#[arg(short, long, num_args(0..), value_hint = ValueHint::DirPath)]
|
||||
pub repos: Option<Vec<PathBuf>>,
|
||||
|
||||
#[arg(short('i'), long("igore"), num_args(0..))]
|
||||
pub ignored_repos: Option<Vec<String>>,
|
||||
|
||||
#[arg(short, long, num_args(0..))]
|
||||
pub branches: Option<Vec<String>>,
|
||||
|
||||
|
|
25
src/main.rs
25
src/main.rs
|
@ -63,7 +63,7 @@ struct Author {
|
|||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
// clear_screen();
|
||||
clear_screen();
|
||||
|
||||
let args = CliArgs::parse();
|
||||
|
||||
|
@ -154,33 +154,24 @@ fn get_color_map() -> Vec<String> {
|
|||
.to_vec()
|
||||
}
|
||||
|
||||
fn find_git_repos(
|
||||
scan_path: &path::Path,
|
||||
repos: &mut Vec<PathBuf>,
|
||||
ignored_repos: &Vec<String>,
|
||||
_args: &CliArgs,
|
||||
) {
|
||||
fn find_git_repos(scan_path: &path::Path, repos: &mut Vec<PathBuf>, _args: &CliArgs) {
|
||||
let Ok(dirs) = scan_path.read_dir()
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
let dirs: Vec<_> = dirs
|
||||
.filter_map(|d| d.ok())
|
||||
.filter(|d| {
|
||||
let dir_name = d.file_name().to_string_lossy().to_string();
|
||||
!ignored_repos.contains(&dir_name)
|
||||
})
|
||||
.filter(|d| d.file_type().is_ok_and(|t| t.is_dir()))
|
||||
.filter_map(|f| f.ok())
|
||||
.filter(|f| f.file_type().is_ok_and(|t| t.is_dir()))
|
||||
.collect_vec();
|
||||
|
||||
let dirs = dirs.iter().map(|d| d.path());
|
||||
let dirs = dirs.iter().map(|f| f.path());
|
||||
|
||||
for dir in dirs {
|
||||
let filename = dir.file_name().unwrap_or_default().to_string_lossy();
|
||||
match filename.as_ref() {
|
||||
".git" => repos.push(dir),
|
||||
_ => find_git_repos(&dir, repos, ignored_repos, _args),
|
||||
_ => find_git_repos(&dir, repos, _args),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -192,12 +183,10 @@ fn get_commits(
|
|||
) -> Result<(usize, Vec<Commit>)> {
|
||||
let mut commits: HashSet<Commit> = HashSet::new();
|
||||
|
||||
let ignored_repos = args.ignored_repos.as_ref().unwrap_or(&vec![]).to_owned();
|
||||
|
||||
let (repos, branches) = match &args.root_dir {
|
||||
Some(root) => {
|
||||
let mut repos: Vec<PathBuf> = vec![];
|
||||
find_git_repos(root, &mut repos, &ignored_repos, &args);
|
||||
find_git_repos(root, &mut repos, &args);
|
||||
let branches = vec!["".to_string(); repos.len()];
|
||||
(repos, branches)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue