ghglob

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2019 License: MIT Imports: 5 Imported by: 1

README

ghglob

Go status releases

ghglob is glob, or more like pattern matcher based on GitHub Actions's Filter pattern spec.

Support multiple patterns including negation (!<pattern>).

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
# 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

Packages

Package GoDoc
ghglob GoDoc - ghglob
ghmatcher GoDoc - ghmatcher

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Glob

func Glob(files chan<- string, patterns []string, opt Option) error

func GlobList

func GlobList(patterns []string, opt Option) ([]string, error)

Types

type Option

type Option struct {
	// True for faster yet non-deterministic enumeration.
	Sort                bool
	FollowSymbolicLinks bool
	Root                string
}

Directories

Path Synopsis
cmd
ghglob command
Package ghmatcher implements pattern matcher which imitates GitHub Actions filter patterns (UNOFFICIAL).
Package ghmatcher implements pattern matcher which imitates GitHub Actions filter patterns (UNOFFICIAL).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL