mirror of
https://github.com/taigrr/yq
synced 2025-01-18 04:53:17 -08:00
Feature: Add append to array
Adds the ability to append a value to an array instead of having to know the index of the values within the array. Resolves: #17
This commit is contained in:
@@ -44,6 +44,29 @@ b:
|
||||
- new thing
|
||||
```
|
||||
|
||||
### Appending value to an array field
|
||||
Given a sample.yaml file of:
|
||||
```yaml
|
||||
b:
|
||||
c: 2
|
||||
d:
|
||||
- new thing
|
||||
- foo thing
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yaml w sample.yaml b.d[+] "bar thing"
|
||||
```
|
||||
will output:
|
||||
```yaml
|
||||
b:
|
||||
c: cat
|
||||
d:
|
||||
- new thing
|
||||
- foo thing
|
||||
- bar thing
|
||||
```
|
||||
|
||||
### Updating files in-place
|
||||
Given a sample.yaml file of:
|
||||
```yaml
|
||||
|
||||
Reference in New Issue
Block a user