yq/docs/search/search_index.json

1 line
27 KiB
JSON
Raw Normal View History

2020-01-13 05:58:11 +00:00
{"config":{"lang":["en"],"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"yq \u00b6 yq is a lightweight and portable command-line YAML processor The aim of the project is to be the jq or sed of yaml files. Install \u00b6 On MacOS: brew install yq On Ubuntu and other Linux distros supporting snap packages: snap install yq On Ubuntu 16.04 or higher from Debian package: sudo add-apt-repository ppa:rmescandon/yq sudo apt update sudo apt install yq -y or, Download latest binary or alternatively: GO111MODULE=on go get github.com/mikefarah/yq/v3 View on GitHub","title":"Install"},{"location":"#yq","text":"yq is a lightweight and portable command-line YAML processor The aim of the project is to be the jq or sed of yaml files.","title":"yq"},{"location":"#install","text":"On MacOS: brew install yq On Ubuntu and other Linux distros supporting snap packages: snap install yq On Ubuntu 16.04 or higher from Debian package: sudo add-apt-repository ppa:rmescandon/yq sudo apt update sudo apt install yq -y or, Download latest binary or alternatively: GO111MODULE=on go get github.com/mikefarah/yq/v3 View on GitHub","title":"Install"},{"location":"convert/","text":"Yaml to Json \u00b6 To convert output to json, use the --tojson (or -j) flag. This is supported by all commands. Each matching yaml node will be converted to json and printed out on a separate line. Given a sample.yaml file of: b: c: 2 then yq r -j sample.yaml will output {\"b\":{\"c\":2}} Given a sample.yaml file of: bob: c: 2 bab: c: 5 then yq r -j sample.yaml b* will output {\"c\":2} {\"c\":5} Json to Yaml \u00b6 To read in json, just pass in a json file instead of yaml, it will just work :) e.g given a json file {\"a\":\"Easy! as one two three\",\"b\":{\"c\":2,\"d\":[3,4]}} then yq r sample.json will output a: Easy! as one two three b: c: 2 d: - 3 - 4","title":"Convert"},{"location":"convert/#yaml-to-json","text":"To convert output to json, use the --tojson (or -j) flag. This is supported by all commands. Each matching yaml node will be converted to json and printed out on a separate line. Given a sample.yaml file of: b: c: 2 then yq r -j sample.yaml will output {\"b\":{\"c\":2}} Given a sample.yaml file of: bob: c: 2 bab: c: 5 then yq r -j sample.yaml b* will output {\"c\":2} {\"c\":5}","title":"Yaml to Json"},{"location":"convert/#json-to-yaml","text":"To read in json, just pass in a json file instead of yaml, it will just work :) e.g given a json file {\"a\":\"Easy! as one two three\",\"b\":{\"c\":2,\"d\":[3,4]}} then yq r sample.json will output a: Easy! as one two three b: c: 2 d: - 3 - 4","title":"Json to Yaml"},{"location":"create/","text":"yq n <path_expression> <new value> Yaml files can be created using the 'new' command. This works in the same way as the write command, but you don't pass in an existing Yaml file. Currently this does not support creating multiple documents in a single yaml file. See docs for path expression Creating a simple yaml file \u00b6 yq n b.c cat will output: b: c: cat Creating using a create script \u00b6 Create scripts follow the same format as the update scripts. Given a script create_instructions.yaml of: - command: update path: b.c value: #great things: frog # wow! then yq n -s create_instructions.yaml will output: b: c: #great things: frog # wow! You can also pipe the instructions in: cat create_instructions.yaml | yq n -s -","title":"Create"},{"location":"create/#creating-a-simple-yaml-file","text":"yq n b.c cat will output: b: c: cat","title":"Creating a simple yaml file"},{"location":"create/#creating-using-a-create-script","text":"Create scripts follow the same format as the update scripts. Given a script create_instructions.yaml of: - command: update path: b.c value: #great things: frog # wow! then yq n -s create_instructions.yaml will output: b: c: #great things: frog # wow! You can also pipe the instructions in: cat create_instructions.yaml | yq n -s -","title":"Creating using a create script"},{"location":"delete/","text":"yq delete <yaml_file|-> <path_expression> The delete command will delete al