cue trim

CUE v0.18.0

remove superfluous fields

Usage

cue trim [flags] [inputs]

trim removes fields from structs that can be inferred from constraints

A field, struct, or list is removed if it is implied by a constraint, such as from an optional field matching a required field, a list type value, a comprehension or any other implied content. It will modify the files in place.

Limitations

Removal is on a best effort basis. Some caveats: - Fields in implied content may refer to fields within the struct in which they are included, but are only resolved on a best-effort basis. - Disjunctions that contain structs in implied content cannot be used to remove fields. - There is currently no verification step: manual verification is required.

Examples:

	$ cat <<EOF > foo.cue
	light: [string]: {
		room:          string
		brightnessOff: *0.0 | >=0 & <=100.0
		brightnessOn:  *100.0 | >=0 & <=100.0
	}
	light: ceiling50: {
		room:          "MasterBedroom"
		brightnessOff: 0.0    // this line
		brightnessOn:  100.0  // and this line will be removed
	}
	EOF
	$ cue trim foo.cue
	$ cat foo.cue
	light: [string]: {
		room:          string
		brightnessOff: *0.0 | >=0 & <=100.0
		brightnessOn:  *100.0 | >=0 & <=100.0
	}
	light: ceiling50: {
		room: "MasterBedroom"
	}

It is guaranteed that the resulting files give the same output as before the removal.

Flags

-n, --dry-run                      only run simulation
-f, --force                        overwrite existing regular files
-o, --outfile string               filename or - for stdout with optional file prefix (run 'cue help filetypes' for more info)
--trace                            trace computation

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