pixelb / crudini

A utility for manipulating ini files
GNU General Public License v2.0
441 stars 63 forks source link

support for editing krb.conf file #45

Open ssbarnea opened 7 years ago

ssbarnea commented 7 years ago

krb.conf file is mostly an ini file but it still have something that makes in incompatible with crudini:

[realms]
EXAMPLE.COM = {
  kdc = kerberos.bos.example.com
  kdc = kerberos.corp.example.com
  default_domain = EXAMPLE.COM
}

Is it possible to edit this file with crudini? If not is there a workaround?

pixelb commented 7 years ago

This would overlap with supporting lists. I.E. EXAMPLE.COM is a multiline item, and we might support editing items in the list. Anyway currently deleting the curly brackets gets you a "valid" ini file. So you could preprocess like:

sed 's/= {/=/; s/^}/ignorelb_=_/'

And postprocess like:

sed 's/=$/= {/; s/^ignorelb_=_/}/'
pixelb commented 1 week ago

Note kerberos config files can also be indented, which can be handled with the --ini-options=ignoreindent option