Skip to content

Commit

Permalink
Tweak to function to allow multiple args
Browse files Browse the repository at this point in the history
Preperatory PR for another related to manual results.

Signed-off-by: John Schnake <jschnake@vmware.com>
  • Loading branch information
johnSchnake committed Jul 28, 2022
1 parent 7f82b6b commit 1ef30df
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/client/results/processing.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func fileOrDefault(files []string, defaultFile string) fileSelector {
// no file is given). If the filename given is empty, it will be ignored
// and the extension matching will be used. If "*" is passed as the extension
// all files will match.
func FileOrExtension(files []string, ext string) fileSelector {
func FileOrExtension(files []string, exts ...string) fileSelector {
return func(fPath string, info os.FileInfo) bool {
if info == nil || info.IsDir() {
return false
Expand All @@ -401,7 +401,12 @@ func FileOrExtension(files []string, ext string) fileSelector {
if len(files) > 0 {
return sliceContains(files, filepath.Base(fPath))
}
return ext == "*" || strings.HasSuffix(fPath, ext)
for _, ext := range exts {
if ext == "*" || strings.HasSuffix(fPath, ext) {
return true
}
}
return false
}
}

Expand Down

0 comments on commit 1ef30df

Please sign in to comment.