Adding splat[] short hand to collect,eval,map,omit,path,pick

This commit is contained in:
Mike Farah
2024-06-16 10:22:42 +10:00
parent 45eda8dbae
commit f1964dece0
8 changed files with 77 additions and 8 deletions
+9
View File
@@ -14,6 +14,15 @@ var evalOperatorScenarios = []expressionScenario{
"D0, P[a b 1], (!!map)::{name: cat}\n",
},
},
{
description: "eval splat",
skipDoc: true,
document: `{pathExp: '.a.b[] | select(.name == "cat")', a: {b: [{name: dog}, {name: cat}]}}`,
expression: `eval(.pathExp)[]`,
expected: []string{
"D0, P[a b 1 name], (!!str)::cat\n",
},
},
{
description: "Dynamically update a path from an environment variable",
subdescription: "The env variable can be any valid yq expression.",