mirror of
https://github.com/go-task/task.git
synced 2025-01-18 04:59:01 +02:00
baac067a1a
fixes #74
29 lines
473 B
Go
29 lines
473 B
Go
package status
|
|
|
|
import (
|
|
"path/filepath"
|
|
"sort"
|
|
|
|
"github.com/mattn/go-zglob"
|
|
"github.com/mitchellh/go-homedir"
|
|
)
|
|
|
|
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 = homedir.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
|
|
}
|