this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cmd/cue: expand the embed help section

Lifting text and examples from the proposal document,
but in shorter format for the sake of a quick summary
as well as dropping some details which don't matter to users.

Fixes #3268.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I8b90923dd43b5c706b9f8cf9dd0bd82513c1ad1d
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199411
Reviewed-by: Matthew Sackman <matthew@cue.works>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+28 -2
+28 -2
cmd/cue/cmd/help.go
··· 198 198 Use: "embed", 199 199 Short: "file embedding", 200 200 Long: ` 201 - The @embed directive can be used to load files of any type as part of CUE 202 - evaluation. 201 + The @embed attribute can be used to load files as part of CUE evaluation. 202 + Embedding must be enabled by a file-level @extern(embed) attribute. 203 + 204 + Embed a single file as follows, which must exist when evaluating: 205 + 206 + @extern(embed) 207 + 208 + package foo 209 + 210 + a: _ @embed(file=foo.json) 211 + 212 + Embed many files of the same type with a glob pattern, 213 + which inserts one field per file matched: 214 + 215 + b: _ @embed(glob=images/*.*, type=binary) 216 + b: [string]: bytes 217 + 218 + Note that "**" glob patterns are not supported at this time. 219 + 220 + If the file extension in "file" or "glob" does not imply a file type, 221 + it must be specified with the "type" encoding as shown above. 222 + See the "filetypes" help topic for more. 223 + 224 + Files containing multiple documents cannot be embedded directly. 225 + For NDJSON or multi-document YAML files, embed as type=text 226 + and use APIs like yaml.Extract to decode as a list. 227 + 228 + Note that embedding cue files is not supported at this time. 203 229 204 230 Note: support for embed is experimental, and is enabled via 205 231 CUE_EXPERIMENT=embed.