String op can now run on custom types

This commit is contained in:
Mike Farah
2022-02-22 14:50:45 +11:00
parent 8142e94349
commit 71706af3d4
6 changed files with 111 additions and 47 deletions
@@ -274,6 +274,24 @@ a: cart
b: heart
```
## Custom types: that are really strings
When custom tags are encountered, yq will try to decode the underlying type.
Given a sample.yml file of:
```yaml
a: !horse cat
b: !goat heat
```
then
```bash
yq '.[] |= sub("(a)", "${1}r")' sample.yml
```
will output
```yaml
a: !horse cart
b: !goat heart
```
## Split strings
Given a sample.yml file of:
```yaml