test config resolving targets
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
@@ -54,7 +55,11 @@ func (config config) Targets() []string {
|
||||
|
||||
func (config config) targets() ([]string, error) {
|
||||
patterns := []string{config.target, fmt.Sprintf("%s.*", config.target)}
|
||||
if stat, err := os.Stat(config.target); err == nil && stat.IsDir() {
|
||||
isDir := false
|
||||
if stat, err := os.Stat(config.target); err == nil {
|
||||
isDir = stat.IsDir()
|
||||
}
|
||||
if isDir {
|
||||
patterns = []string{fmt.Sprintf("%s/*", config.target)}
|
||||
}
|
||||
|
||||
@@ -68,6 +73,9 @@ func (config config) targets() ([]string, error) {
|
||||
}
|
||||
|
||||
if len(result) == 0 {
|
||||
if isDir {
|
||||
return []string{path.Join(config.target, "root.yaml")}, nil
|
||||
}
|
||||
return []string{config.target}, nil
|
||||
}
|
||||
return result, nil
|
||||
|
||||
Reference in New Issue
Block a user