Skip to content

Commit

Permalink
lib/cuetils: don't move orphaned files which cue does not understand
Browse files Browse the repository at this point in the history
  • Loading branch information
verdverm committed Jul 10, 2022
1 parent 112485f commit 5c02248
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/cuetils/runtime.go
Expand Up @@ -125,6 +125,9 @@ func (CRT *CueRuntime) load() (err error) {
continue
}

// TODO, compare with len(entrypoints)
// and be more intelligent

// handle data files
for _, f := range bi.OrphanedFiles {
d, err := os.ReadFile(f.Filename)
Expand All @@ -149,7 +152,7 @@ func (CRT *CueRuntime) load() (err error) {
}
bi.AddSyntax(F)

case "yaml":
case "yml", "yaml":
F, err := yaml.Extract(f.Filename, d)
if err != nil {
fmt.Println("while yaml extract")
Expand All @@ -158,9 +161,16 @@ func (CRT *CueRuntime) load() (err error) {
}
bi.AddSyntax(F)

// TODO, handle other formats (toml,json)
// which hof already works with

default:
err := fmt.Errorf("unknown encoding for", f.Filename, f.Encoding)
errs = append(errs, err)
// should only do this if it was also an arg
// otherwise we should ignore other files implicity discovered

// todo, re-enable this with better checks
// err := fmt.Errorf("unknown encoding for", f.Filename, f.Encoding)
// errs = append(errs, err)
continue
}
}
Expand Down

0 comments on commit 5c02248

Please sign in to comment.