Compile against latest hare main branch.
compile against current hare master
report filename on write-error
I want to manipulate my dotfiles setup from makefiles like this:
workmachine: indite -w machine.at_work=true localrc ...
So that make workmachine
will set everything up and change the local setup
specific to the machine.
Tests for this setup in other places look like this if [ $(indite -r machine.at_work localrc) = "true" ];...
.
The file format indite understands is quite simple:
# Header comments # Header comments [section1] key=value key=value # entry comment [section2] # Section comment # Section comment key=value # entry comment key.subkey=value
indite
allows to read values with -r keypath
, and setting values with -w
keypath=value
.
The key path has the form `section.key[.subkey]`. The existence of subkeys is
of no concern to indite
, there is no im- or explicit tree structure.
indite
is written in hare.
If -r
is given, indite uses stdlibs format::ini
parser.
To preserve the sequence of settings and comments, if -w
is given, indite
reads the complete ini file into memory, without optimization considerations for
now. The current implementation is straight forward. This is my first contact
with hare, and the only goal for now is a working tool for my use case.
Line comments (lines starting with #
) are only allowed at the beginning of the
file and directly after a section-start. If you alter a file with line comments
else where, they will change place and be all gathered at the allowed place.
Entry comments (anything after the first `#` after the value) will be kept on subsequent changes to the entry. To remove a comment, an empty comment has to be set (see the man page).
The ini file can be given as `-`, indite
will read from stdin and write to
stdout in that case (see the man page).
If the section name contains full stops, these have to be escaped, e.g.
indite -r www\\.example\\.org.login credentials.ini
indite
is part of my dotfiles project. Report bugs and ideas by opening
tickets or writing to the public-inbox mailing list. You can
drop in a possibly very asynchronous conversation on IRC