Skip to content

Commit

Permalink
Add check for whether file was explicitly named
Browse files Browse the repository at this point in the history
  • Loading branch information
jtigger committed May 20, 2022
1 parent cbdd80d commit 4415549
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/cmd/template/data_values_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ func (s *DataValuesFlags) file(fullPath string, strict bool) ([]*datavalues.Enve

var result []*datavalues.Envelope
for _, dvFile := range dvFiles {
// skip non-YAML files that are contained within the specified directory
if strings.Contains(dvFile.RelativePath(), "/") && !(dvFile.Type() == files.TypeYAML) {
if dvFile.IsImplied() && !(dvFile.Type() == files.TypeYAML) {
continue
}
contents, err := dvFile.Bytes()
Expand Down
6 changes: 6 additions & 0 deletions pkg/files/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ func (r *File) isTemplate() bool {
return !r.IsLibrary() && (t == TypeYAML || t == TypeText)
}

// IsImplied reports whether this file was implicitly included (found within an explicitly named directory) or not
// (named explicitly as input).
func (r *File) IsImplied() bool {
return strings.ContainsRune(r.OriginalRelativePath(), os.PathSeparator)
}

func (r *File) IsLibrary() bool {
exts := strings.Split(filepath.Base(r.RelativePath()), ".")

Expand Down

0 comments on commit 4415549

Please sign in to comment.