tini icon indicating copy to clipboard operation
tini copied to clipboard

Support for key, value pairs without a section?

Open kvrohit opened this issue 3 years ago • 3 comments
trafficstars

As described in this wiki article: https://en.wikipedia.org/wiki/INI_file#Sections

Keys may, but need not, be grouped into arbitrarily named sections

I want to create an ini file that resembles something like this:

authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1 = *.github.com

Notice that the first set of key, value pairs do not belong to any section.

Using tini for creating this type of ini results in the following:

[]
authorityKeyIdentifier = keyid,issuer
basicConstraints = CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1 = *.github.com

Is there a way to tell it to not create the empty [] section?

kvrohit avatar Jun 14 '22 07:06 kvrohit

This feature is not supported.

Unfortunately, there is no time to update the API or implement 2.0

But you may add check for empty section here.

FreeCX avatar Jun 14 '22 08:06 FreeCX

Ah, I see. Thanks for your quick response and for creating this crate. The API is intuitive and the docs are pretty good when compared to similar libraries. I hope you get some time to work on 2.0.

kvrohit avatar Jun 14 '22 08:06 kvrohit

Thank you!

FreeCX avatar Jun 14 '22 08:06 FreeCX