mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-12 19:25:37 +00:00
Improved set path example
This commit is contained in:
parent
fdad478684
commit
af7e36bd47
@ -122,7 +122,7 @@ a:
|
|||||||
b: things
|
b: things
|
||||||
```
|
```
|
||||||
|
|
||||||
## Set path to extract prune deep paths
|
## Set path to prune deep paths
|
||||||
Like pick but recursive. This uses `ireduce` to deeply set the selected paths into an empty object,
|
Like pick but recursive. This uses `ireduce` to deeply set the selected paths into an empty object,
|
||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
|
@ -89,7 +89,7 @@ var pathOperatorScenarios = []expressionScenario{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Set path to extract prune deep paths",
|
description: "Set path to prune deep paths",
|
||||||
subdescription: "Like pick but recursive. This uses `ireduce` to deeply set the selected paths into an empty object,",
|
subdescription: "Like pick but recursive. This uses `ireduce` to deeply set the selected paths into an empty object,",
|
||||||
document: documentToPrune,
|
document: documentToPrune,
|
||||||
expression: "(.parentB.child2, .parentC.child1) as $i\n ireduce({}; setpath($i | path; $i))",
|
expression: "(.parentB.child2, .parentC.child1) as $i\n ireduce({}; setpath($i | path; $i))",
|
||||||
|
Loading…
Reference in New Issue
Block a user