github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/docs/2-the-jackal-cli/100-cli-commands/jackal_tools_yq.md (about)

     1  # jackal tools yq
     2  <!-- Auto-generated by hack/gen-cli-docs.sh -->
     3  
     4  yq is a lightweight and portable command-line data file processor.
     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  ```
    12  jackal tools yq [flags]
    13  ```
    14  
    15  ## Examples
    16  
    17  ```
    18  
    19  # yq defaults to 'eval' command if no command is specified. See "jackal tools yq eval --help" for more examples.
    20  
    21  # read the "stuff" node from "myfile.yml"
    22  jackal tools yq '.stuff' < myfile.yml
    23  
    24  # update myfile.yml in place
    25  jackal tools yq -i '.stuff = "foo"' myfile.yml
    26  
    27  # print contents of sample.json as idiomatic YAML
    28  jackal tools yq -P sample.json
    29  
    30  ```
    31  
    32  ## Options
    33  
    34  ```
    35    -C, --colors                        force print with colors
    36        --csv-auto-parse                parse CSV YAML/JSON values (default true)
    37        --csv-separator char            CSV Separator character (default ,)
    38    -e, --exit-status                   set exit status if there are no matches or null or false is returned
    39        --expression string             forcibly set the expression argument. Useful when yq argument detection thinks your expression is a file.
    40        --from-file string              Load expression from specified file.
    41    -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
    42        --header-preprocess             Slurp any header comments and separators before processing expression. (default true)
    43    -h, --help                          help for yq
    44    -I, --indent int                    sets indent level for output (default 2)
    45    -i, --inplace                       update the file in place of first file given.
    46    -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")
    47        --lua-globals                   output keys as top-level global variables
    48        --lua-prefix string             prefix (default "return ")
    49        --lua-suffix string             suffix (default ";\n")
    50        --lua-unquoted                  output unquoted string keys (e.g. {foo="bar"})
    51    -M, --no-colors                     force print with no colors
    52    -N, --no-doc                        Don't print document separators (---)
    53    -0, --nul-output                    Use NUL char to separate values. If unwrap scalar is also set, fail if unwrapped scalar contains NUL char.
    54    -n, --null-input                    Don't read input, simply evaluate the expression given. Useful for creating docs from scratch.
    55    -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")
    56    -P, --prettyPrint                   pretty print, shorthand for '... style = ""'
    57        --properties-array-brackets     use [x] in array paths (e.g. for SpringBoot)
    58        --properties-separator string   separator to use between keys and values (default " = ")
    59    -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.
    60        --split-exp-file string         Use a file to specify the split-exp expression.
    61        --string-interpolation          Toggles strings interpolation of \(exp) (default true)
    62        --tsv-auto-parse                parse TSV YAML/JSON values (default true)
    63    -r, --unwrapScalar                  unwrap scalar, print the value with no quotes, colors or comments. Defaults to true for yaml (default true)
    64    -v, --verbose                       verbose mode
    65    -V, --version                       Print version information and quit
    66        --xml-attribute-prefix string   prefix for xml attributes (default "+@")
    67        --xml-content-name string       name for xml content (if no attribute name is present). (default "+content")
    68        --xml-directive-name string     name for xml directives (e.g. <!DOCTYPE thing cat>) (default "+directive")
    69        --xml-keep-namespace            enables keeping namespace after parsing attributes (default true)
    70        --xml-proc-inst-prefix string   prefix for xml processing instructions (e.g. <?xml version="1"?>) (default "+p_")
    71        --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)
    72        --xml-skip-directives           skip over directives (e.g. <!DOCTYPE thing cat>)
    73        --xml-skip-proc-inst            skip over process instructions (e.g. <?xml version="1"?>)
    74        --xml-strict-mode               enables strict parsing of XML. See https://pkg.go.dev/encoding/xml for more details.
    75  ```
    76  
    77  ## SEE ALSO
    78  
    79  * [jackal tools](jackal_tools.md)	 - Collection of additional tools to make airgap easier
    80  * [jackal tools yq eval](jackal_tools_yq_eval.md)	 - (default) Apply the expression to each document in each yaml file in sequence
    81  * [jackal tools yq eval-all](jackal_tools_yq_eval-all.md)	 - Loads _all_ yaml documents of _all_ yaml files and runs expression once