Is there a tool for managing entries of a config file? E.g: by toggling comments, or setting some keys to some values. I know, for a one-time configuration it's easy to just use sed or awk like:
awk '/regex/ {print "# " $0} !/regex/ {print}' ~/.config/foo.cfg
The problem with this is that it's limited to one kind of .cfg
files and will re-invent the wheel for handling other config files like .json, .yaml, etc...
Example usage: pass specific values of often-used settings to dmenu, then let the user quickly toggle these settings on or off without having to go to a specific application, then its settings and search through the settings.
More concrete example: cfgman --toggle "youtube.com" /etc/hosts
This looks for all lines in config file matching youtube.com, then determine the comment type of that file, then toggle the comments on the matched lines. This lets the user for example create "Focus time" scripts.
Other examples:
- Change value of
pageTemplate
in~/.config/xournalpp/settings.xml
. - Change value of default view in
~/.config/calcurse/conf
- Retrieve values of specific config properties
There are many other usage for this. It basically creates a unified interface to access all settings. The equivalent of getent
but for users config.