Skip to content

Commit

Permalink
feat: Allow excluding directories
Browse files Browse the repository at this point in the history
Fixes #3
  • Loading branch information
NoUseFreak committed Mar 12, 2024
1 parent bb605ea commit dcde73a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,10 @@ renameRepo:
# Add extra static directories outside of the basedir
extraDirs:
- $HOME/.config/nvim

# Exclude directories you don't want to include in the fuzzyfinder
excludeDirs:
- $HOME/src/gitlab.com/oldstuff

```

13 changes: 13 additions & 0 deletions internal/pkg/repo/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ func GetRepoPathsChan(basedir string, includeExtras bool) <-chan string {
if !entry.IsDir() {
continue
}
if inExcludeList(basedir) {
continue
}
if entry.Name() == ".git" {
out <- basedir
return
Expand All @@ -66,6 +69,16 @@ func GetRepoPathsChan(basedir string, includeExtras bool) <-chan string {
return out
}

func inExcludeList(name string) bool {
excludes := viper.GetStringSlice("excludeDirs")
for _, exclude := range excludes {
if name == ExpandPath(exclude) {
return true
}
}
return false
}

func GetRepoPathsAsync(baseDir string, result *[]string) error {
ch := GetRepoPathsChan(baseDir, true)
for p := range ch {
Expand Down

0 comments on commit dcde73a

Please sign in to comment.