jzelinskie / faq

Format Agnostic jQ -- process various formats with libjq
Apache License 2.0
439 stars 14 forks source link

faq to read/write ini files? #75

Open vielmetti opened 4 years ago

vielmetti commented 4 years ago

Any consderation of support for .ini files, the somewhat standardized format often used for config files?

I see a Go library https://github.com/go-ini/ini that could be useful, and there's a proof of concept (in Ruby) called dupervisor or dv https://github.com/kigster/dupervisor that provides a 3-way yaml/json/ini tricoder but no filter/manipulation.

jzelinskie commented 4 years ago

Interesting! I always had thought that ini was unspecified and thus a parsing nightmare depending on what program or person created the file. This looks doable, but I clearly need to familiarize myself with ini a bit more to understand any corner cases.

If anyone is interested in implementing this or is familiar enough to talk on behalf of ini, I'm all ears.

vielmetti commented 4 years ago

Yeah, I expect that there's some skew possible due the lack of standards, so I'm perfectly willing to guess that this is arbitrarily hard to get exactly right for every possible version.

A quick look at other code that does this perhaps to help the next person along:

Of these the last, ini-parser, perhaps has the most flexibility in dealing with the existing variation in file types, and https://github.com/rickyah/ini-parser/wiki/Configuring-parser-behavior gives you some idea of the degrees of freedom that have evolved in response.