kvz / bash3boilerplate

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

Enhanced ini file handling #128

Closed rfuehrer closed 4 years ago

rfuehrer commented 4 years ago

Thanks for contributing to b3bp! As part of your PR, have you:

-[x] Added an item in CHANGELOG.md with attribution? -[x] Added your name to the README.md -[ ] Linted your code? (make test should do the trick)


With the additions, following functions are now implemented:

checked scenarios: -[x] create/read key from ini file not existing -[x] create/read key in section not existing -[x] create/update existing key/value in existing section -[x] read key/value

kvz commented 4 years ago

Happy to merge once the tests pass!

rfuehrer commented 4 years ago

Fixed the sed commands to support mac and linux (-rn => -En and sed regexs) but CI failed again. Can you help with Travis and the supposedly error?!

Checked scenarios: -[x] create/read key from ini file not existing -[x] create/read key in section not existing -[x] create/update existing key/value in existing section -[x] read key/value -[x] tested linux platform (Linux xxxx 3.10.105 #24922 SMP Wed Jul 3 16:35:48 CST 2019 x86_64 GNU/Linux synologycedarview...) -[x] tested mac platform (Darwin xxxx 19.2.0 Darwin Kernel Version 19.2.0: Sat Nov 9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64 x86_64)

rfuehrer commented 4 years ago

I found my mistake - shame on me ;) The defined test scenario had to be adapted to the function of the default section, because the previous "data.ini" had given the line "orphan = exists" without section. In the new behaviour the expectation can not be fulfilled without the default section. I have now extended the file "data.ini" with the default section "[default]".

The last commits were (due to lack of experience) only due to the CI pipeline and the automatic error checking. Please excuse the unnecessary commits...

The Mac test now runs perfectly. The linux test breaks before the automatic tests with an error during the installation of "cabal-install".

The command "if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get install --allow-unauthenticated -y cabal-install; fi" failed and exited with 100 during .

Here I am at my wit's end. I lack the experience to correct something here - can you help?

Please note:

I have to keep in mind that the behaviour seems to be more robust now, but all instances of the project that have been in use so far will no longer determine values for keys without given sections when reading existing ini files. Existing ini files may need to be adapted.

kvz commented 4 years ago

Thanks! Sounds like a breaking change so I'll major bump the release then.

kvz commented 4 years ago

Seems the build failed after all. On mobile now, could you take a look?