1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00

Can assign-update style

This commit is contained in:
Mike Farah
2021-01-06 20:37:53 +11:00
parent 8c1f7dfbd7
commit 5a1b81cbfc
4 changed files with 76 additions and 29 deletions

View File

@@ -145,7 +145,7 @@ will output
{a: cat, b: 5, c: 3.2, e: true}
```
## Pretty print
## Reset style - or pretty print
Set empty (default) quote style, note the usage of `...` to match keys too. Note that there is a `--prettyPrint/-P` short flag for this.
Given a sample.yml file of:
@@ -167,6 +167,22 @@ c: 3.2
e: true
```
## Set style relatively with assign-update
Given a sample.yml file of:
```yaml
a: single
b: double
```
then
```bash
yq eval '.[] style |= .' sample.yml
```
will output
```yaml
a: 'single'
b: "double"
```
## Read style
Given a sample.yml file of:
```yaml