https://github.com/thomasheller/braceexpansion
Shell brace expansion in Go
https://github.com/thomasheller/braceexpansion
golang parser shell
Last synced: 10 months ago
JSON representation
Shell brace expansion in Go
- Host: GitHub
- URL: https://github.com/thomasheller/braceexpansion
- Owner: thomasheller
- License: mit
- Created: 2017-03-14T06:45:53.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-11-29T20:30:23.000Z (about 5 years ago)
- Last Synced: 2025-02-13T14:40:34.518Z (12 months ago)
- Topics: golang, parser, shell
- Language: Go
- Size: 8.79 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# braceexpansion
[](https://travis-ci.org/thomasheller/braceexpansion)
[](https://goreportcard.com/report/github.com/thomasheller/braceexpansion)
[](https://coveralls.io/github/thomasheller/braceexpansion?branch=master)
Shell brace expansion implemented in Go (golang).
Supports some specialties required by
[multigoogle](https://github.com/thomasheller/multigoogle).
Numeric ranges are currently not supported, as I didn't need them.
Feel free to send a PR.
## Build
```sh
$ cd cmd && go build -o be
```
## Usage (command line):
```sh
$ be '{a,b}{1,2}'
a1
a2
b1
b2
```
## Usage (library):
```go
import (
be "github.com/thomasheller/braceexpansion"
"fmt"
)
func main() {
tree, err := be.New().Parse("{a,b}{1,2}")
if err != nil {
panic(err)
}
for _, s := range tree.Expand() {
fmt.Println(s)
}
// Output:
// a1
// a2
// b1
// b2
}
```