thomasheller / braceexpansion

Shell brace expansion in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

braceexpansion

Build Status Go Report Card Coverage Status

Shell brace expansion implemented in Go (golang).

Supports some specialties required by multigoogle.

Numeric ranges are currently not supported, as I didn't need them. Feel free to send a PR.

Build

$ cd cmd && go build -o be

Usage (command line):

$ be '{a,b}{1,2}'
a1
a2
b1
b2

Usage (library):

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
}

About

Shell brace expansion in Go

License:MIT License


Languages

Language:Go 100.0%