Skip to content

Commit

Permalink
check for manifests in root when bucket dir does not exists, fixes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
shilangyu committed Nov 20, 2020
1 parent a0e2455 commit 41f6adc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ func main() {
for _, bucket := range buckets {
wg.Add(1)
go func(file os.FileInfo) {
res := matchingManifests(bucketsPath+"\\"+file.Name()+"\\bucket", args.query)
// check if $bucketName/bucket exists, if not use $bucketName
bucketPath := bucketsPath + "\\" + file.Name()
if f, err := os.Stat(bucketPath + "\\bucket"); !os.IsNotExist(err) && f.IsDir() {
bucketPath += "\\bucket"
}

res := matchingManifests(bucketPath, args.query)
matches.Lock()
matches.data[file.Name()] = res
matches.Unlock()
Expand Down
5 changes: 4 additions & 1 deletion tests/integration.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
go build .

$terms = "fl", "android", "sudo", "", "azure", "t", "a", "P", "G", "as"
# add a bucket that holds manifests in root
scoop bucket add github-gh https://github.com/cli/scoop-gh.git

$terms = "fl", "android", "sudo", "", "azure", "t", "a", "P", "G", "as", "gh"

foreach ($term in $terms) {
$s1 = (./scoop-search.exe $term)
Expand Down

0 comments on commit 41f6adc

Please sign in to comment.