Nice! How do I bring new function into scope though? This looks very similar to hawk, which has documentation on how to add your custom code [1].
Also, there are some nice CLI tools for JSON [2] or CSV [3] specific data.
[1] https://github.com/gelisam/hawk
[2] https://stedolan.github.io/jq/manual/
[3] https://github.com/BurntSushi/xsv/blob/master/README.md