mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Need to escape single quotes in bash, updated docs #1932
This commit is contained in:
parent
f46e04d6f2
commit
461bb9c5fe
@ -168,8 +168,8 @@ fruit:
|
||||
then
|
||||
```bash
|
||||
yq '.[] |(
|
||||
( select(kind == "scalar") | key + "='" + . + "'"),
|
||||
( select(kind == "seq") | key + "=(" + (map("'" + . + "'") | join(",")) + ")")
|
||||
( select(kind == "scalar") | key + "='\''" + . + "'\''"),
|
||||
( select(kind == "seq") | key + "=(" + (map("'\''" + . + "'\''") | join(",")) + ")")
|
||||
)' sample.yml
|
||||
```
|
||||
will output
|
||||
@ -203,8 +203,8 @@ deep:
|
||||
then
|
||||
```bash
|
||||
yq '.. |(
|
||||
( select(kind == "scalar" and parent | kind != "seq") | (path | join("_")) + "='" + . + "'"),
|
||||
( select(kind == "seq") | (path | join("_")) + "=(" + (map("'" + . + "'") | join(",")) + ")")
|
||||
( select(kind == "scalar" and parent | kind != "seq") | (path | join("_")) + "='\''" + . + "'\''"),
|
||||
( select(kind == "seq") | (path | join("_")) + "=(" + (map("'\''" + . + "'\''") | join(",")) + ")")
|
||||
)' sample.yml
|
||||
```
|
||||
will output
|
||||
|
Loading…
Reference in New Issue
Block a user