mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-06 10:04:43 +08:00
Added eval operator
This commit is contained in:
@@ -53,6 +53,16 @@ var envOperatorScenarios = []expressionScenario{
|
||||
"D0, P[], ()::a: \"12\"\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Dynamically evaluate a path from an environment variable",
|
||||
subdescription: "The env variable can be any valid yq expression.",
|
||||
document: `{a: {b: [{name: dog}, {name: cat}]}}`,
|
||||
environmentVariable: ".a.b[0].name",
|
||||
expression: `eval(strenv(myenv))`,
|
||||
expected: []string{
|
||||
"D0, P[a b 0 name], (!!str)::dog\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Dynamic key lookup with environment variable",
|
||||
environmentVariable: "cat",
|
||||
|
||||
Reference in New Issue
Block a user