You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use this library to parse our config for please
One thing I'm trying to figure out is updating config automatically for our users. For example, if they want to add language support to their project, I want to be able to plz init java and that will add:
[java]
javac = /opt/java/bin/javac
I was thinking it wouldn't be too crazy if we maintain the original token stream. We can detect any changes/new non-zero entries in the struct, and append these to the first instance of the relevant section (i.e. [java]).
I just thought I would open up an issue here and see if this is something you'd be interested in having upstream.
The text was updated successfully, but these errors were encountered:
Thanks for the feedback. Writing/updating gcfg files is something that I would be interested in having upstream. (Historically there was a ticket for this back when the project was on Google Code, but it wasn't migrated here, sorry.)
However I'm not sure if re-serialization is possible; it seems hard to check for changed values, considering the fact that Go doesn't provide a standardized way of checking for equality. (The closest we have is reflect.DeepEqual() but it is not guaranteed to work with user-defined types.) What could be done more easily is to have a function that takes a section name, subsection name, variable name and new value, and updates that value.
Even then, there are some tricky issues with the handling of comments; changing a value may make a comment invalid, and also keeping indenting of comments is non-trivial esp. for multilanguage files. One way to approach these issues is to check what git config does in such situations.
We use this library to parse our config for please
One thing I'm trying to figure out is updating config automatically for our users. For example, if they want to add language support to their project, I want to be able to
plz init java
and that will add:I was thinking it wouldn't be too crazy if we maintain the original token stream. We can detect any changes/new non-zero entries in the struct, and append these to the first instance of the relevant section (i.e.
[java]
).I just thought I would open up an issue here and see if this is something you'd be interested in having upstream.
The text was updated successfully, but these errors were encountered: