kvz / bash3boilerplate

Templates to write better Bash scripts
http://bash3boilerplate.sh
MIT License
2.12k stars 198 forks source link

Add comment feature to ini files #130

Closed rfuehrer closed 4 years ago

rfuehrer commented 4 years ago

Following PR inserts the function of an optional fourth parameter in the function ini_val() When new INI entries are inserted into an ini file, a comment can now be added to the new entry. The following call

ini_val "file.ini" "section.key" "value" "comment"

now the following ini entries are written

[section]
;[key] comment
key=value

The function is compatible with previous versions. A set comment cannot be overwritten/changed afterwards!

The PR also contains customized test scenarios that check the setting and reading of values created with comments.

rfuehrer commented 4 years ago

In an upcoming feature the editing of comments will be possible. By embedding ";[key]" in the comment you can search for this position without having to remember the previous line via regex.

if the PR should be held back by this, i think that's ok. i expect an implementation within the next days

kvz commented 4 years ago

:+1: