Skip to content

Commit 8f552be

Browse files
jpluscplusmmvdan
authored andcommitted
cmd/cue: mention vet-c's three behaviours
This improves the cue-vet help text by mentioning the different behaviours engaged when the --concrete/-c flag is: - absent - present without a value / set with -c=true - set with -c=false The flag's tri-state behaviour is being considered in #2120 but, irrespective of any changes that might result, the current behaviour is undocumented outside the source code; hence this change. The -c flag's single line help message is updated to mention -c=false. The command is also introduced (via its opening line) with a complete sentence that starts with a capital letter and ends with a period, giving the Go-doc-unware user more confidence that they're reading a complete sentence and not some truncated fragment. Also: correct a cue/CUE capitalisation typo; make a compound sentence flow better. The cue-help-eval text also mentions this flag, but it's not clear to me that its handling of this flag is identical so the same change isn't applied there. For #2120. Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I687840fe5bdcbc464ee4fdfcd6e6f0fba9ef327a Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1207991 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent 0be3c85 commit 8f552be

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

cmd/cue/cmd/vet.go

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,21 @@ import (
2222
"cuelang.org/go/cue/errors"
2323
)
2424

25-
const vetDoc = `vet validates CUE and other data files
25+
const vetDoc = `The vet command validates CUE and other data files.
2626
27-
By default it will only validate if there are no errors.
28-
The -c validates that all regular fields are concrete.
27+
The command is silent when it succeeds, emitting no output and an exit code of
28+
zero. Otherwise, errors are reported and the command returns a non-zero exit
29+
code.
30+
31+
vet starts by ensuring that there are no validation errors. If errors are found
32+
then they are reported and the command exits.
33+
34+
If there are no validation errors then, by default, vet checks that the result
35+
of the evaluation is concrete. It reports an error if the evaluation contains
36+
any regular fields that have non-concrete values.
37+
Skip this step by specifying -c=false, which permits regular fields to have
38+
non-concrete values. Specify -c/-c=true to report errors mentioning which
39+
regular fields have non-concrete values.
2940
3041
3142
Checking non-CUE files
@@ -39,12 +50,12 @@ currently supported:
3950
TOML .toml
4051
TEXT .txt (validate a single string value)
4152
42-
To activate this mode, the non-cue files must be explicitly mentioned on the
53+
To activate this mode, the non-CUE files must be explicitly mentioned on the
4354
command line. There must also be at least one CUE file to hold the constraints.
4455
4556
In this mode, each file will be verified against a CUE constraint. If the files
46-
contain multiple objects (such as using --- in YAML), they will all be verified
47-
individually.
57+
contain multiple objects (such as using --- in YAML) then each object will be
58+
verified individually.
4859
4960
By default, each file is checked against the root of the loaded CUE files.
5061
The -d can be used to only verify files against the result of an expression
@@ -75,7 +86,7 @@ func newVetCmd(c *Command) *cobra.Command {
7586
addInjectionFlags(cmd.Flags(), false, false)
7687

7788
cmd.Flags().BoolP(string(flagConcrete), "c", false,
78-
"require the evaluation to be concrete")
89+
"require the evaluation to be concrete, or set -c=false to allow incomplete values")
7990

8091
return cmd
8192
}

0 commit comments

Comments
 (0)