mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-07 02:48:27 +08:00
Added parents operator
This commit is contained in:
@@ -29,6 +29,15 @@ var parentOperatorScenarios = []expressionScenario{
|
||||
"D0, P[b name], (!!str)::sam\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Get parents",
|
||||
subdescription: "Match all parents",
|
||||
document: "{a: {b: {c: cat} } }",
|
||||
expression: `.a.b.c | parents`,
|
||||
expected: []string{
|
||||
"D0, P[], (!!seq)::- {c: cat}\n- {b: {c: cat}}\n- {a: {b: {c: cat}}}\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "N-th parent",
|
||||
subdescription: "You can optionally supply the number of levels to go up for the parent, the default being 1.",
|
||||
|
||||
Reference in New Issue
Block a user