summaryrefslogtreecommitdiffstats
path: root/src/projects/entry.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/projects/entry.rs')
-rw-r--r--src/projects/entry.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/projects/entry.rs b/src/projects/entry.rs
index 08ed07a..739ed83 100644
--- a/src/projects/entry.rs
+++ b/src/projects/entry.rs
@@ -1,4 +1,4 @@
-use ignore::{Walk, WalkBuilder};
+use ignore::{DirEntry, Walk, WalkBuilder};
use serde::{Deserialize, Deserializer, Serialize};
use std::{convert::Infallible, path::PathBuf, str::FromStr};
@@ -10,6 +10,12 @@ pub struct SearchPath {
pub max_depth: Option<usize>,
}
+impl SearchPath {
+ pub fn filter(dir_entry: &DirEntry) -> bool {
+ dir_entry.path().join(".git").exists()
+ }
+}
+
impl From<PathBuf> for SearchPath {
fn from(path: PathBuf) -> Self {
Self {
@@ -25,6 +31,7 @@ impl From<SearchPath> for Walk {
.standard_filters(true)
.max_depth(value.max_depth)
.hidden(!value.hidden)
+ .filter_entry(SearchPath::filter)
.build()
}
}