Open GoogleCodeExporter opened 8 years ago
Paramjit Oberoi to iniparse-discus
Aug 30
I can see how this can be useful in some situations...
But I'm not sure about rename() - how about comment() and uncomment()
functions instead?
Also, what if the option was specified multiple times? Should
comment() comment out all of them? Or only the last one? If only the
last one is commented out, does the previous one become the active
value?
Uncomment should only uncomment one line, I think - the last one.
Should it be an error if multiple lines match?
Implementation wise, there are two choices. One, as you suggest, is
to modify the parsing to detect all lines that are comments but could
have been valid options. Alternatively, when comment() or uncomment()
is called, the comments could be re-parsed to identify the line to be
replaced.
Finally, what about this:
[foo]
bar=3
x=7
# [baz]
# y=9
A simple implementation of .uncomment('foo', 'y') will uncomment the
'y' in the commented out 'baz' section...
-param
Original comment by psobe...@gmail.com
on 25 Sep 2007 at 4:16
Tim Lauridsen to iniparse-discuss
Aug 30
Paramjit Oberoi wrote:
> But I'm not sure about rename() - how about comment() and uncomment()
> functions instead?
Sounds fine
> Also, what if the option was specified multiple times? Should
> comment() comment out all of them? Or only the last one? If only the
> last one is commented out, does the previous one become the active
> value?
comment() should comment all options out in the same section
> Uncomment should only uncomment one line, I think - the last one.
> Should it be an error if multiple lines match?
uncomment() should only the first one in a section and return the number
of remaining hit, it make it possible to
call uncomment() again until all are uncommented, if that is what the
user want.
Original comment by psobe...@gmail.com
on 25 Sep 2007 at 4:18
Paramjit Oberoi to iniparse-discuss
Sep 9
As I was thinking about this, I realized that although INIConfig
objects preserve comments, etc., they only provide read/write access
to values. Maybe it's worth thinking about creating an API to access
other details of the config file?
Original comment by psobe...@gmail.com
on 25 Sep 2007 at 4:19
Tim Lauridsen to iniparse-discuss
Sep 9
It would be very nice if there was an API to read/write other stuff in
the config file. Here is some ideas.
* comment/uncomment (we have discussed this one)
* Add new comments before/in option line.
* remove comment in/before option line
* rename section.
Original comment by psobe...@gmail.com
on 25 Sep 2007 at 4:20
Original issue reported on code.google.com by
psobe...@gmail.com
on 25 Sep 2007 at 4:15