|
|
|
Show HN: Toolbox – A framework for modular Bash scripts
(m10k.eu)
|
|
3 points
by m10k
1612 days ago
|
|
Everyday, I have to deal with Bash scripts and all the code duplication and unreadableness that comes with it. One day I found myself implementing an include function so that I could easily modularize my scripts, and it worked better than I had anticipated. That's how toolbox started. At first, I wrote some simple modules for command line parsing and locking, but then I tried to see how far I could push the poor shell. I wrote modules for semaphores and "thread"-safe queues, and this is where things quickly started to escalate. To implement a distributed build system that automates packaging/signing/publishing of toolbox Debian packages, I wrote a module for message-based IPC that supports point-to-point and pub-sub communication. Performance was never a consideration, but it works really well without consuming excessive resources. Some of the modules are arguably serious abuse of the shell, but I found that toolbox makes it possible to write Bash scripts that are readable, testable, and reliable. Shell isn't a terribly nice language, but it's great for integrating and automating things, so I thought others might find this useful, too. (I am going to publish the build system as well, as soon as I am done writing the documentation.) |
|
You should put in a README on Github some how-to and explain what "modules" are available for inclusion and how they work!