mirror of
https://github.com/mikefarah/yq.git
synced 2026-08-24 08:22:13 +08:00
Generic ast (#1829)
Remove dependency on yaml.Node for internal AST representation. Yaml decoder is now just another decoder.
This commit is contained in:
@@ -31,6 +31,38 @@ cities:
|
||||
- Perth
|
||||
`,
|
||||
},
|
||||
{
|
||||
skipDoc: true,
|
||||
description: "path",
|
||||
expression: ".cities[2] | path",
|
||||
input: `return {
|
||||
["country"] = "Australia"; -- this place
|
||||
["cities"] = {
|
||||
"Sydney",
|
||||
"Melbourne",
|
||||
"Brisbane",
|
||||
"Perth",
|
||||
};
|
||||
};
|
||||
`,
|
||||
expected: "- cities\n- 2\n",
|
||||
},
|
||||
{
|
||||
skipDoc: true,
|
||||
description: "path",
|
||||
expression: ".cities[2] | key",
|
||||
input: `return {
|
||||
["country"] = "Australia"; -- this place
|
||||
["cities"] = {
|
||||
"Sydney",
|
||||
"Melbourne",
|
||||
"Brisbane",
|
||||
"Perth",
|
||||
};
|
||||
};
|
||||
`,
|
||||
expected: "2\n",
|
||||
},
|
||||
{
|
||||
description: "Basic output example",
|
||||
scenarioType: "encode",
|
||||
|
||||
Reference in New Issue
Block a user