cue-lang / cue

The home of the CUE language! Validate and define text-based and dynamic configuration
https://cuelang.org
Apache License 2.0
5.03k stars 287 forks source link

cmd/cue: better error message required when provided .cue files are not valid #741

Open cueckoo opened 3 years ago

cueckoo commented 3 years ago

Originally opened by @egidijusz in https://github.com/cuelang/cue/issues/741

Hello,

as title says - cue fails to parse files passed as cli arguments if filenames contain underscore (_).

What version of CUE are you using (cue version)?

$ cue version
cue version 0.2.2 linux/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

$ echo 'foo: "bar"' > sometest.cue
$ cue eval sometest.cue
foo: "bar"
$ mv sometest.cue some_test.cue
$ ls some_test.cue
some_test.cue
$ cue eval some_test.cue
no CUE files in command-line-arguments

What did you expect to see?

foo: "bar"

What did you see instead?

no CUE files in command-line-arguments

cueckoo commented 3 years ago

Original reply by @mpvl in https://github.com/cuelang/cue/issues/741#issuecomment-774743760

_test.cue is reserved for CUE test files.

cueckoo commented 3 years ago

Original reply by @egidijusz in https://github.com/cuelang/cue/issues/741#issuecomment-774752179

This is correct. cue eval|export works fine with foo_bar.cue for example.

I had a case of tunnel-vision when trying to import configs of test servers (conveniently suffixed with _test.yml). :facepalm:

Sorry for false alarm and thank you for your time!

P.s. I'm not sure if I should close the issue now (because of new label, roadmap/errors).

cueckoo commented 3 years ago

Original reply by @myitcv in https://github.com/cuelang/cue/issues/741#issuecomment-774892714

Thanks @egidijusz - we'll leave this open - I've retitled the issue to better reflect what we need to do.

bttk commented 2 years ago

I think I've run into a similar issue. I spent a few hours debugging my workflow until I saw this:

$ cue def ./tmp/*.cue
cycle error {...}

$ cue def ./tmp/__table_1_import.cue 
no CUE files in command-line-arguments

Turns out, if you specify multiple files on the command line, files starting with "__" get silently ignored even if I specify --all-errors --verbose

myitcv commented 2 years ago

Hmm. Not sure why this issue got closed as part of the migration. Re-opening.