From 5c022484345d862a8b3fa131ef71ea0a58c5aa36 Mon Sep 17 00:00:00 2001 From: Tony Worm Date: Sat, 9 Jul 2022 21:07:14 -0400 Subject: [PATCH] lib/cuetils: don't move orphaned files which cue does not understand --- lib/cuetils/runtime.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/cuetils/runtime.go b/lib/cuetils/runtime.go index 59d5d2957..3f95869fa 100644 --- a/lib/cuetils/runtime.go +++ b/lib/cuetils/runtime.go @@ -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) @@ -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") @@ -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 } }