github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/docs/2-the-jackal-cli/100-cli-commands/jackal_tools_yq_eval-all.md (about) 1 # jackal tools yq eval-all 2 <!-- Auto-generated by hack/gen-cli-docs.sh --> 3 4 Loads _all_ yaml documents of _all_ yaml files and runs expression once 5 6 ## Synopsis 7 8 yq is a portable command-line data file processor (https://github.com/mikefarah/yq/) 9 See https://mikefarah.gitbook.io/yq/ for detailed documentation and examples. 10 11 # Evaluate All ## 12 This command loads _all_ yaml documents of _all_ yaml files and runs expression once 13 Useful when you need to run an expression across several yaml documents or files (like merge). 14 Note that it consumes more memory than eval. 15 16 17 ``` 18 jackal tools yq eval-all [expression] [yaml_file1]... [flags] 19 ``` 20 21 ## Examples 22 23 ``` 24 25 # Merge f2.yml into f1.yml (inplace) 26 jackal tools yq eval-all --inplace 'select(fileIndex == 0) * select(fileIndex == 1)' f1.yml f2.yml 27 # the same command and expression using shortened names: 28 jackal tools yq ea -i 'select(fi == 0) * select(fi == 1)' f1.yml f2.yml 29 30 31 # Merge all given files 32 jackal tools yq ea '. as $item ireduce ({}; . * $item )' file1.yml file2.yml ... 33 34 # Pipe from STDIN 35 # use '-' as a filename to pipe from STDIN 36 cat file2.yml | jackal tools yq ea '.a.b' file1.yml - file3.yml 37 38 ``` 39 40 ## Options 41 42 ``` 43 -h, --help help for eval-all 44 ``` 45 46 ## Options inherited from parent commands 47 48 ``` 49 -C, --colors force print with colors 50 --csv-auto-parse parse CSV YAML/JSON values (default true) 51 --csv-separator char CSV Separator character (default ,) 52 -e, --exit-status set exit status if there are no matches or null or false is returned 53 --expression string forcibly set the expression argument. Useful when yq argument detection thinks your expression is a file. 54 --from-file string Load expression from specified file. 55 -f, --front-matter string (extract|process) first input as yaml front-matter. Extract will pull out the yaml content, process will run the expression against the yaml content, leaving the remaining data intact 56 --header-preprocess Slurp any header comments and separators before processing expression. (default true) 57 -I, --indent int sets indent level for output (default 2) 58 -i, --inplace update the file in place of first file given. 59 -p, --input-format string [auto|a|yaml|y|json|j|props|p|csv|c|tsv|t|xml|x|base64|uri|toml|lua|l] parse format for input. (default "auto") 60 --lua-globals output keys as top-level global variables 61 --lua-prefix string prefix (default "return ") 62 --lua-suffix string suffix (default ";\n") 63 --lua-unquoted output unquoted string keys (e.g. {foo="bar"}) 64 -M, --no-colors force print with no colors 65 -N, --no-doc Don't print document separators (---) 66 -0, --nul-output Use NUL char to separate values. If unwrap scalar is also set, fail if unwrapped scalar contains NUL char. 67 -n, --null-input Don't read input, simply evaluate the expression given. Useful for creating docs from scratch. 68 -o, --output-format string [auto|a|yaml|y|json|j|props|p|csv|c|tsv|t|xml|x|base64|uri|toml|shell|s|lua|l] output format type. (default "auto") 69 -P, --prettyPrint pretty print, shorthand for '... style = ""' 70 --properties-array-brackets use [x] in array paths (e.g. for SpringBoot) 71 --properties-separator string separator to use between keys and values (default " = ") 72 -s, --split-exp string print each result (or doc) into a file named (exp). [exp] argument must return a string. You can use $index in the expression as the result counter. 73 --split-exp-file string Use a file to specify the split-exp expression. 74 --string-interpolation Toggles strings interpolation of \(exp) (default true) 75 --tsv-auto-parse parse TSV YAML/JSON values (default true) 76 -r, --unwrapScalar unwrap scalar, print the value with no quotes, colors or comments. Defaults to true for yaml (default true) 77 -v, --verbose verbose mode 78 --xml-attribute-prefix string prefix for xml attributes (default "+@") 79 --xml-content-name string name for xml content (if no attribute name is present). (default "+content") 80 --xml-directive-name string name for xml directives (e.g. <!DOCTYPE thing cat>) (default "+directive") 81 --xml-keep-namespace enables keeping namespace after parsing attributes (default true) 82 --xml-proc-inst-prefix string prefix for xml processing instructions (e.g. <?xml version="1"?>) (default "+p_") 83 --xml-raw-token enables using RawToken method instead Token. Commonly disables namespace translations. See https://pkg.go.dev/encoding/xml#Decoder.RawToken for details. (default true) 84 --xml-skip-directives skip over directives (e.g. <!DOCTYPE thing cat>) 85 --xml-skip-proc-inst skip over process instructions (e.g. <?xml version="1"?>) 86 --xml-strict-mode enables strict parsing of XML. See https://pkg.go.dev/encoding/xml for more details. 87 ``` 88 89 ## SEE ALSO 90 91 * [jackal tools yq](jackal_tools_yq.md) - yq is a lightweight and portable command-line data file processor.