jwodder / javaproperties

Python library for reading & writing Java .properties files
MIT License
30 stars 10 forks source link

Support for properties dict while retaining comments? #1

Closed dimaspivak closed 7 years ago

dimaspivak commented 7 years ago

Hey there,

I've been looking for a full-featured library to handle Java properties and your implementation looks to be the most thorough on the internet, so +1 for that. :) My use case is that I want to be able to load a .properties file, change just a handful of lines, and then serialize it back to a file (while retaining comments, blank lines, etc.). I've discovered the low-level parse method which returns a generator of tuples, but is there an in-built way to create an object from a .properties file which has k-v lookup/modification along with the ability to serialize back to a file with comments?

If not, would you be open to a PR to add such support? I'd be happy to do it if you could give me guidance on how you'd prefer the design to look.

jwodder commented 7 years ago

Bad news: I started thinking about the design of such a class and accidentally thought so hard that I wrote the whole thing; is this the sort of thing you had in mind?

dimaspivak commented 7 years ago

Dang, John. We're not worthy. This is perfect! Thank you so much.