cue exp writefs

CUE v0.18.0

remove and create files in bulk

Usage

cue exp writefs

WARNING: THIS COMMAND IS EXPERIMENTAL. In the future, it will be entirely replaced by native @export(...) as described in https://cuelang.org/issue/2031.

writefs takes JSON via stdin in the form of

	// tool is the name of the tool that initiated the writefs call.
	tool!: string
	// remove is a list of glob patterns of files to remove before creating new ones.
	remove?: [...string]
	// create is the set of files to create, keyed by Unix file paths.
	create?: [filepath=string]: {
		type!:     "symlink"
		contents!: string
	} | *{
		type: "file"
		// encoding can be set to a filetype like "text", "json", or "yaml"
		// to control how the arbitrary concrete value in contents is encoded.
		// When unset, the filepath extension is used to infer an encoding,
		// with a fallback to "text" for filepaths with no extension.
		encoding?: string
		contents!: _
	}

For example, this tool can be used via "cue cmd" as follows:

	command: gen: exec.Run & {
		cmd: ["cue", "exp", "writefs"]
		stdin: json.Marshal({
			tool: "cue cmd gen"
			remove: ["out/*.yaml"]
			create: {
				"out/foo.yaml": {contents: {body: "some struct"}}
				"out/bar.yaml": {contents: [some list]}
			}
		})
	}

Global flags

-E, --all-errors                   print all available errors
-C, --chdir string                 change working directory before running command (must be the first flag)
-i, --ignore                       proceed in the presence of errors
-s, --simplify                     simplify output
Install CUE