https://github.com/haya14busa/ghglob
ghglob is glob, or more like pattern matcher based on GitHub Actions's Filter pattern spec. [UNOFFICIAL]
https://github.com/haya14busa/ghglob
github-actions glob
Last synced: 9 months ago
JSON representation
ghglob is glob, or more like pattern matcher based on GitHub Actions's Filter pattern spec. [UNOFFICIAL]
- Host: GitHub
- URL: https://github.com/haya14busa/ghglob
- Owner: haya14busa
- License: mit
- Created: 2019-10-05T06:02:45.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-11T14:08:13.000Z (almost 6 years ago)
- Last Synced: 2025-01-04T01:44:36.314Z (11 months ago)
- Topics: github-actions, glob
- Language: Go
- Homepage:
- Size: 38.1 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ghglob
[](https://github.com/haya14busa/ghglob/actions)
[](https://github.com/haya14busa/ghglob/releases)
[](https://codecov.io/gh/haya14busa/ghglob)
**ghglob** is glob, or more like pattern matcher based on GitHub Actions's
[Filter pattern spec](https://help.github.com/en/articles/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet).
Support multiple patterns including negation (`!`).
## Spec
> - `*` matches zero or more characters, but does not match the / character
> - `**` matches zero or more of any character
> - `?` matches zero or one of the proceeding character
> - `+` matches one or more of the proceeding character
> - `[]` matches any character listed, or included in ranges. Ranges can only include a-zA-Z0-9. e.g [123abc] or [0-9a-f]
> - `!` at the start of a pattern makes it negate previous positive patterns. It has no special meaning if not the first character
>
> -- https://help.github.com/en/articles/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
## CLI
### Installation
```shell
# Install latest version. (Install it into ./bin/ by default).
$ curl -sfL https://raw.githubusercontent.com/haya14busa/ghglob/master/install.sh| sh -s
# Specify installation directory ($(go env GOPATH)/bin/) and version.
$ curl -sfL https://raw.githubusercontent.com/haya14busa/ghglob/master/install.sh| sh -s -- -b $(go env GOPATH)/bin [vX.Y.Z]
# In alpine linux (as it does not come with curl by default)
$ wget -O - -q https://raw.githubusercontent.com/haya14busa/ghglob/master/install.sh| sh -s [vX.Y.Z]
$ go get github.com/haya14busa/ghglob/cmd/ghglob
# homebrew / linuxbrew
$ brew install haya14busa/tap/ghglob
$ brew upgrade haya14busa/tap/ghglob
# Go
$ go get github.com/haya14busa/ghglob/cmd/ghglob
```
### Example usages
```
$ ghglob '**/*.go'
cmd/ghglob/main.go 99
ghmatcher/ghmatcher.go
ghmatcher/ghmatcher_test.go
ghglob_test.go
ghglob.go
_testdir/main.go
cmd/ghglob/main.go
# Support negation pattern.
$ git ls-files | ghglob '**.go' '!**_test.go'
_testdir/main.go
cmd/ghglob/main.go
ghglob.go
ghmatcher/ghmatcher.go
# List .js or .jsx files.
$ ghglob '**.jsx?'
# As CLI arguments. e.g. https://github.com/koalaman/shellcheck
$ shellcheck $(ghglob '**/*.sh')
# gofmt except test data.
$ gofmt -d -s $(ghglob '**.go' '!_testdir/**')
# Run golint against only changed files.
$ git diff --name-only master | ghglob '**.go' | xargs -i golint {}
```
## Packages
| Package | GoDoc |
| ------- | ----- |
| ghglob | [](https://godoc.org/github.com/haya14busa/ghglob) |
| ghmatcher | [](https://godoc.org/github.com/haya14busa/ghglob/ghmatcher) |