Merge pull request #2619 from vtolstov/artifice
allow wildcards in artifice files
This commit is contained in:
commit
e60b3745f5
@ -3,6 +3,7 @@ package artifice
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -13,13 +14,18 @@ type Artifact struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewArtifact(files []string) (*Artifact, error) {
|
func NewArtifact(files []string) (*Artifact, error) {
|
||||||
|
artifact := &Artifact{}
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
if _, err := os.Stat(f); err != nil {
|
globfiles, err := filepath.Glob(f)
|
||||||
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
for _, gf := range globfiles {
|
||||||
artifact := &Artifact{
|
if _, err := os.Stat(gf); err != nil {
|
||||||
files: files,
|
return nil, err
|
||||||
|
}
|
||||||
|
artifact.files = append(artifact.files, gf)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return artifact, nil
|
return artifact, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user