Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wishlist: put options next to commented-out ones #22

Open
mgedmin opened this issue Apr 21, 2015 · 1 comment
Open

Wishlist: put options next to commented-out ones #22

mgedmin opened this issue Apr 21, 2015 · 1 comment

Comments

@mgedmin
Copy link

mgedmin commented Apr 21, 2015

I have a config file that looks like this:

[pov-server-page]

# If set to 0 (default), running pov-update-server-page won't do anything
# enabled = 1

# Apache password file; use htpasswd(1) to create and manage it
# auth_user_file = /etc/pov/fridge.passwd

When I change any of the options crudini puts the new setting at the top of the section:

$ git diff /etc/pov/server-page.conf
--- a/pov/server-page.conf
+++ b/pov/server-page.conf
@@ -1,4 +1,5 @@
 [pov-server-page]
+enabled = 1

 # If set to 0 (default), running pov-update-server-page won't do anything
 # enabled = 1

Is there any chance crudini could recognize the existing commented-out option and put the new value after it?

Complication: multiline options exist, e.g.

# Uncomment to compute disk usage of certain locations once a day
# disk_usage =
#     /var
#     /home
# Alternatively, detect all mounted partitions with
# disk_usage = all

and ideally the newly-added one would be after the entire comment block.

(If you're curious, the config file is for pov-server-page)

@pixelb
Copy link
Owner

pixelb commented Apr 21, 2015

Yes that's a very common use case and already mentioned at
https://github.com/pixelb/crudini/blob/cde14b3/TODO#L3

There would need to be large changes to the parser to track comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants