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

Added anchor operator

This commit is contained in:
Mike Farah
2020-12-22 11:57:41 +11:00
parent e5aa4a87a4
commit f112bde5fe
5 changed files with 111 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
## Get anchor
Given a sample.yml file of:
```yaml
a: &billyBob cat
```
then
```bash
yq eval '.a | anchor' sample.yml
```
will output
```yaml
billyBob
```
## Set anchor name
Given a sample.yml file of:
```yaml
a: cat
```
then
```bash
yq eval '.a anchor = "foobar"' sample.yml
```
will output
```yaml
a: &foobar cat
```