mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-05 17:36:59 +08:00
Added pick including all keys example
This commit is contained in:
@@ -14,6 +14,15 @@ var pickOperatorScenarios = []expressionScenario{
|
||||
"D0, P[], (!!map)::myMap: {hamster: squeak, cat: meow}\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Pick keys from map, included all the keys",
|
||||
subdescription: "We create a map of the picked keys plus all the current keys, and run that through unique",
|
||||
document: "myMap: {cat: meow, dog: bark, thing: hamster, hamster: squeak}\n",
|
||||
expression: `.myMap |= pick( (["thing"] + keys) | unique)`,
|
||||
expected: []string{
|
||||
"D0, P[], (!!map)::myMap: {thing: hamster, cat: meow, dog: bark, hamster: squeak}\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Pick splat",
|
||||
skipDoc: true,
|
||||
|
||||
Reference in New Issue
Block a user