Skip to content

Commit 4e92634

Browse files
committed
cmd/cue: add new CUE_EXPERIMENT and CUE_DEBUG flags to help environment
We haven't done a very good job at keeping `cue help environment` up to date with the actual set of flags supported by CUE_EXPERIMENT and CUE_DEBUG via their internal packages. While here, update the Go docs a bit so that they are consistent with what is documented in `cue help`, and add reminders to both types to update the help text as well. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I68e7a1a94a18de648ba850e3c4a1a2a427e441af Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1205567 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Matthew Sackman <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
1 parent 0e99c20 commit 4e92634

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

cmd/cue/cmd/help.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,22 @@ If an environment variable is unset or empty, sensible default setting is used.
306306
decodeint64
307307
Tweak cue.Value.Decode to choose "int64" rather than "int"
308308
as the default Go type for CUE integer values.
309+
toposort
310+
Enable topological sorting of struct fields.
311+
Provide feedback via https://cuelang.org/issue/3558
309312
310313
CUE_DEBUG
311314
Comma-separated list of debug flags to enable or disable, such as:
312315
313316
http
314317
Log a JSON message per HTTP request and response made
315318
when interacting with module registries.
319+
sortfields
320+
Force fields in stucts to be sorted lexicographically.
321+
openinline (default true)
322+
Permit disallowed fields to be selected into literal struct
323+
that would normally result in a close error, mimicking evalv2
324+
closedness behavior in evalv3 to aid the transition.
316325
317326
CUE_EXPERIMENT and CUE_DEBUG are comma-separated lists of key-value strings,
318327
where the value is a boolean "true" or "1" if omitted. For example:
@@ -321,6 +330,9 @@ where the value is a boolean "true" or "1" if omitted. For example:
321330
`[1:],
322331
}
323332

333+
// Please keep the CUE_EXPERIMENT and CUE_DEBUG lists above in sync with
334+
// the cueexperiment and cuedebug packages.
335+
324336
var modulesHelp = &cobra.Command{
325337
Use: "modules",
326338
Short: "module support",

internal/cuedebug/cuedebug.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@ import (
66
"cuelang.org/go/internal/envflag"
77
)
88

9-
// Flags holds the set of CUE_DEBUG flags. It is initialized by Init.
9+
// Flags holds the set of global CUE_DEBUG flags. It is initialized by Init.
1010
var Flags Config
1111

12+
// Flags holds the set of known CUE_DEBUG flags.
13+
//
14+
// When adding, deleting, or modifying entries below,
15+
// update cmd/cue/cmd/help.go as well for `cue help environment`.
1216
type Config struct {
17+
// HTTP enables JSON logging per HTTP request and response made
18+
// when interacting with module registries.
1319
HTTP bool
1420

1521
// TODO: consider moving these evaluator-related options into a separate

internal/cueexperiment/exp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"cuelang.org/go/internal/envflag"
77
)
88

9-
// Flags holds the set of CUE_EXPERIMENT flags. It is initialized by Init.
9+
// Flags holds the set of global CUE_EXPERIMENT flags. It is initialized by Init.
1010
//
1111
// When adding, deleting, or modifying entries below,
1212
// update cmd/cue/cmd/help.go as well for `cue help environment`.
@@ -25,7 +25,7 @@ var Flags struct {
2525
// to ensure consistency with 32-bit platforms.
2626
DecodeInt64 bool
2727

28-
// Enable topological sorting of struct fields
28+
// Enable topological sorting of struct fields.
2929
TopoSort bool
3030
}
3131

0 commit comments

Comments
 (0)