I've been diving in and out of INI files at work a lot lately. One of our projects uses them to manage state in important ways, and some days it feels like all I've done is set or delete the same handful of values, check the results, then do it all over again. (Kind of like that schtick at the optometrist. "One. Two. Back to one. Here comes two again...")
If you're not familiar, INI files contain
key=value configuration definitions like this:
city=Portland street=SW 11th Avenue zip=97205
Sometimes they get real fancy and use sections:
[weather] aqi=54 humidity=37 temperature=73 visibility=10
Unlike JSON and YAML files, which explode any time you have the audacity to overlook a trailing comma or rudely insert tabs instead of spaces, INI files aren't a hassle to edit by hand. Still, I found myself wishing for the simplicity and ease of that old Mac command-line standby, defaults.
So, I wrote innie, a tool for reading, writing, and deleting INI file entries. I even made a little icon, which is pretty ridiculous for something that runs in a terminal:
Borrowing a page from defaults, it offers three subcommands —
delete. Let's take it for a quick spin:
$ innie read ./data.ini zip 97205 $ innie write ./data.ini zip 97206 $ innie read ./data.ini zip 97206 $ innie delete ./data.ini zip $ innie read ./data.ini zip innie: No such key 'zip'
Impressive, huh? 😉
"What about those swanky sections we saw earlier?" you ask, observant as ever. innie supports dot-notation for referencing nested keys:
$ innie write ./data.ini weather.aqi 58