Hi, I am curious if there could be a CLI tool similar to jq or yq, for conveniently querying and transforming TOML files?
It's a structured data format, so looking at what jq does, it seems to me that similar things could be done for TOML. All it needs is somebody to be inspired to write the tool.
Could you explain what the practical use cases for such tool would be for you? For jq I can imagine a few use cases easily, JSON being a popular data transport format. To me TOML is a configuration format, making such tool less of a natural fit.
One use case that pops to mind for me would be the use of tq (let's call it that ;-) ) from within for example bash scripts, making it possible to use configuration data from TOML files easily from within those scripts. Of course the same goes for running commands from a shell, and for which you want to extract some configuration data from a TOML file.
But for these use cases (which I do find interesting myself), wouldn't need much more than a basic query tool, to fetch values and lists from a TOML file. It would not need transformation capabilities to filter a TOML file and export a transformed / filtered new TOML file.
There could be -- there isn't one yet AFAIK.
Folks are more than welcome to make one!
I found this: https://github.com/jamesmunns/tomlq
Hope it helps! Or maybe you can also contribute.
Just for the record, a tool like that is usefull (for me) to be able to automate tests against toml files. (get/read case)
Or either to automate chances in toml files in a more robust way than sedops would do. :) (set/write case)
So far, "https://crates.io/crates/toml-cli" has been very helpful for test purposes.
Another useful tool is this: https://github.com/TomWright/dasel
It supports JSON, YAML and TOML.