mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-13 22:38:04 +00:00
Simplify json > yaml cli example
This commit is contained in:
parent
78e9cc7998
commit
e08b6803f5
14
README.md
14
README.md
@ -30,9 +30,6 @@ When merging multiple files together, `eval-all/ea` is still required to tell `y
|
||||
|
||||
## Quick Usage Guide
|
||||
|
||||
|
||||
|
||||
|
||||
Read a value:
|
||||
```bash
|
||||
yq '.a.b[0].c' file.yaml
|
||||
@ -60,7 +57,6 @@ Merge multiple files
|
||||
yq ea '. as $item ireduce ({}; . * $item )' path/to/*.yml
|
||||
```
|
||||
|
||||
|
||||
Multiple updates to a yaml file
|
||||
```bash
|
||||
yq -i '
|
||||
@ -70,7 +66,12 @@ yq -i '
|
||||
' file.yaml
|
||||
```
|
||||
|
||||
See the [documentation](https://mikefarah.gitbook.io/yq/) for more.
|
||||
Convert JSON to YAML
|
||||
```bash
|
||||
yq -P sample.json
|
||||
```
|
||||
|
||||
See the [documentation](https://mikefarah.gitbook.io/yq/) for more examples.
|
||||
|
||||
## Install
|
||||
|
||||
@ -172,8 +173,6 @@ yq() {
|
||||
podman run --rm -i -v "${PWD}":/workdir mikefarah/yq "$@"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### Running as root:
|
||||
|
||||
`yq`'s container image no longer runs under root (https://github.com/mikefarah/yq/pull/860). If you'd like to install more things in the container image, or you're having permissions issues when attempting to read/write files you'll need to either:
|
||||
@ -208,7 +207,6 @@ RUN apk add --no-cache tzdata
|
||||
USER yq
|
||||
```
|
||||
|
||||
|
||||
### GitHub Action
|
||||
```
|
||||
- name: Set foobar to cool
|
||||
|
@ -24,7 +24,7 @@ cat myfile.yml | yq '.stuff'
|
||||
yq -i '.stuff = "foo"' myfile.yml
|
||||
|
||||
# print contents of sample.json as idiomatic YAML
|
||||
yq -P '.' sample.json
|
||||
yq -P sample.json
|
||||
`,
|
||||
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
Loading…
Reference in New Issue
Block a user