Simplify json > yaml cli example

This commit is contained in:
Mike Farah 2022-03-20 10:55:24 +11:00
parent 78e9cc7998
commit e08b6803f5
2 changed files with 7 additions and 9 deletions

View File

@ -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

View File

@ -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 {