go-task / slim-sprig

Useful template functions for Go templates.
https://go-task.github.io/slim-sprig/
MIT License
62 stars 16 forks source link

[dict] retrieve function #7

Open ghostsquad opened 2 years ago

ghostsquad commented 2 years ago

currently get looks like this:

get $myDict "key1"

which supports a workflow such as coalesce "foo" "" | get $myDict


This is a request to support the opposite workflow:

retrieve "key1" $myDict

which could be used like:

`. | retrieve  "value"`

I'm not really sure if retrieve if the right verb here, but order matters if you want succinct code and to use pipes in go templates.