mirror of
https://github.com/go-task/task.git
synced 2026-06-24 21:26:04 +00:00
So a path like this works: $GOPATH/src/github.com/go-task/task
Allowing of "~" was also implemented. See #74 and baac067a1a
Fixes #116
30 lines
479 B
Go
30 lines
479 B
Go
package status
|
|
|
|
import (
|
|
"path/filepath"
|
|
"sort"
|
|
|
|
"github.com/go-task/task/internal/osext"
|
|
|
|
"github.com/mattn/go-zglob"
|
|
)
|
|
|
|
func glob(dir string, globs []string) (files []string, err error) {
|
|
for _, g := range globs {
|
|
if !filepath.IsAbs(g) {
|
|
g = filepath.Join(dir, g)
|
|
}
|
|
g, err = osext.Expand(g)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
f, err := zglob.Glob(g)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
files = append(files, f...)
|
|
}
|
|
sort.Strings(files)
|
|
return
|
|
}
|