Skip to content

Commit

Permalink
refactor: include doublestar
Browse files Browse the repository at this point in the history
  • Loading branch information
cugu committed Oct 19, 2024
1 parent 061f6f2 commit b1523b4
Show file tree
Hide file tree
Showing 7 changed files with 993 additions and 6 deletions.
4 changes: 1 addition & 3 deletions artifacts/expansion.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (
"regexp"
"runtime"
"strings"

"github.com/forensicanalysis/fsdoublestar"
)

const windows = "windows"
Expand Down Expand Up @@ -231,7 +229,7 @@ func expandPath(fs fs.FS, syspath string, prefixes []string, collector ArtifactC
expandedPath = strings.Replace(expandedPath, "{", `\{`, -1)
expandedPath = strings.Replace(expandedPath, "}", `\}`, -1)

unglobedPaths, err := fsdoublestar.Glob(fs, expandedPath)
unglobedPaths, err := doublestar.Glob(fs, expandedPath)
if err != nil {
log.Println(err)

Expand Down
22 changes: 22 additions & 0 deletions doublestar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Recursive directory globbing via `**` for Go's [io/fs](https://golang.org/pkg/io/fs).

## Example

``` golang
func main() {
// get file system for this repository
wd, _ := os.Getwd()
fsys := os.DirFS(wd)

// get all yml files
matches, _ := fsdoublestar.Glob(fsys, "**/*.yml")

// print matches
fmt.Println(matches)
// Output: [.github/workflows/ci.yml .github/.golangci.yml]
}
```

## Acknowledgement

This repository is based on [Bob Matcuk's](https://github.com/bmatcuk) great [doublestar](https://github.com/bmatcuk/doublestar) package.
Loading

0 comments on commit b1523b4

Please sign in to comment.