Git Product home page Git Product logo

Comments (3)

TGWolf avatar TGWolf commented on August 25, 2024

The output you are seeing is correct given how the script was designed to work.

process_ini_file test.ini - this will parse the file and store the results in memory

process_ini_file test.conf - this will parse the second file but with the first file still in memory

The net result of working you are doing is:

cat < test.ini
[my_test]
test_1 = A
EOT

cp test.ini test.conf
cat test.ini test.conf > merged.ini
process_ini_file merged.ini

The code allows you to process multiple files in a script and treat them all as one merged in / config file.

It should be easy enough to add an option to purge anything that has already been loaded either with an additional optional parameter to process_inI_file

process_ini_file <purge_flag>

or another function which allows you to file by file

process_ini_file
process_ini_file
process_ini_file
purge_ini_file

from ini-file-parser.

TBarregren avatar TBarregren commented on August 25, 2024

Thanks for the quick response (and great script). I realize my mistake. i got the "error" when i tested the script. In reality, it won't be a problem. So for me it only remains to suggest to mention this to the documenation. Hats off.

from ini-file-parser.

TGWolf avatar TGWolf commented on August 25, 2024

I will add it to my backlog, as I like the idea of being able to purge loaded items or remove specific items and maybe even add a function to write the merged config into a new file.

To be honest this only exists because of a bet. A friend said he had never seen an ini file parser for bash (most languages have one or several implementations). I said it shouldn't be that hard to do it, and his reply was "I bet you can't" ... so I did :)

I have a lot of other projects on the go, and never really came back to this one to see what new cool things I could add to it, so it is nice to get a reminder it is still out there.

from ini-file-parser.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.