Skip to content

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

@mgedmin

Description

@mgedmin

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions