MCPcopy Index your code
hub / github.com/augmentable-dev/tickgit / SearchDir

Function SearchDir

pkg/comments/comments.go:68–107  ·  view source on GitHub ↗

SearchDir searches a directory for comments

(dirPath string, cb func(comment *Comment))

Source from the content-addressed store, hash-verified

66
67// SearchDir searches a directory for comments
68func SearchDir(dirPath string, cb func(comment *Comment)) error {
69 err := godirwalk.Walk(dirPath, &godirwalk.Options{
70 Callback: func(path string, de *godirwalk.Dirent) error {
71 localPath, err := filepath.Rel(dirPath, path)
72 if err != nil {
73 return err
74 }
75 pathComponents := strings.Split(localPath, string(os.PathSeparator))
76 // let's ignore git directories TODO: figure out a more generic way to set ignores
77 matched, err := filepath.Match(".git", pathComponents[0])
78 if err != nil {
79 return err
80 }
81 if matched {
82 return nil
83 }
84 if de.IsRegular() {
85 p, err := filepath.Abs(path)
86 if err != nil {
87 return err
88 }
89 f, err := os.Open(p)
90 if err != nil {
91 return err
92 }
93 err = SearchFile(localPath, f, cb)
94 if err != nil {
95 return err
96 }
97 f.Close()
98 }
99 return nil
100 },
101 Unsorted: true,
102 })
103 if err != nil {
104 return err
105 }
106 return nil
107}
108
109// SearchCommit searches all files in the tree of a given commit
110func SearchCommit(commit *object.Commit, cb func(*Comment)) error {

Callers 8

todos.goFile · 0.92
TestJSFilesFunction · 0.85
TestLispFilesFunction · 0.85
TestRustFilesFunction · 0.85
TestPHPFilesFunction · 0.85
TestKotlinFilesFunction · 0.85
TestJuliaFilesFunction · 0.85
TestElixirFilesFunction · 0.85

Calls 1

SearchFileFunction · 0.85

Tested by 7

TestJSFilesFunction · 0.68
TestLispFilesFunction · 0.68
TestRustFilesFunction · 0.68
TestPHPFilesFunction · 0.68
TestKotlinFilesFunction · 0.68
TestJuliaFilesFunction · 0.68
TestElixirFilesFunction · 0.68