Skip to content

Commit 0dccbf3

Browse files
committed
cmd/cue: add TOML to a couple of help topics I forgot about
Neither `cue help filetypes` nor `cue help vet` listed it next to YAML, which was an omission on my part when I added TOML support to cmd/cue. This made me wonder for a second whether `cue vet` would support TOML files out of the box already, so I added a test to confirm this. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I3f0d06f3234c5b4d566c47a912d062b5b16c3a1e Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198859 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Roger Peppe <[email protected]>
1 parent db92bf8 commit 0dccbf3

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

cmd/cue/cmd/help.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ var filetypeHelp = &cobra.Command{
491491
cue .cue CUE source files.
492492
json .json JSON files.
493493
yaml .yaml/.yml YAML files.
494+
toml .toml TOML files
494495
jsonl .jsonl/.ldjson Line-separated JSON values.
495496
jsonschema JSON Schema.
496497
openapi OpenAPI schema.

cmd/cue/cmd/testdata/script/vet_data.txtar

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
! exec cue vet schema.cue data.yaml
2-
cmp stderr vet-stderr
2+
cmp stderr yaml-stderr
33

44
! exec cue export schema.cue data.yaml
5-
cmp stderr export-stderr
5+
cmp stderr yaml-stderr
6+
7+
# Ensure this also works for other encodings.
8+
9+
# TODO(mvdan): note that TOML lacks position information still.
10+
! exec cue vet schema.cue data.toml
11+
cmp stderr toml-stderr
612

713
-- schema.cue --
814
#Language: {
@@ -19,12 +25,20 @@ languages:
1925
name: dutch
2026
- tag: no
2127
name: Norwegian
22-
23-
-- vet-stderr --
28+
-- data.toml --
29+
[[languages]]
30+
name = 'English'
31+
tag = 'en'
32+
[[languages]]
33+
name = 'dutch'
34+
tag = 'nl'
35+
[[languages]]
36+
name = 'Norwegian'
37+
tag = 'no'
38+
-- yaml-stderr --
2439
languages.1.name: invalid value "dutch" (out of bound =~"^\\p{Lu}"):
2540
./schema.cue:3:8
2641
./data.yaml:5:11
27-
-- export-stderr --
42+
-- toml-stderr --
2843
languages.1.name: invalid value "dutch" (out of bound =~"^\\p{Lu}"):
2944
./schema.cue:3:8
30-
./data.yaml:5:11

cmd/cue/cmd/vet.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ currently supported:
3636
Format Extensions
3737
JSON .json .jsonl .ndjson
3838
YAML .yaml .yml
39+
TOML .toml
3940
TEXT .txt (validate a single string value)
4041
4142
To activate this mode, the non-cue files must be explicitly mentioned on the

0 commit comments

Comments
 (0)