Bash Script Compiler 0.1
A helper / compiler to maintain bigger bash script projects where you develop in multiple files, one file per function, so everything should be better maintainable.
You can create new stub projects with this so you do not need to take care about the boilerplate code, just implement your neccessary functions, help, code completion.
On executing this script merges everything together into a file in a dist folder in the project.
Getting started
Execute
bash-script-compiler new
and answer the questions to create a new bash script project.
Main idea
TODO explain the directory structure src/ src/functions scr/help src/intro.sh src/main.sh src/xyz-completion LICENSE README.md VERSION
Split
- Put the main part of your project into the ./src/main.sh file. It will be the entrypoint for your script;
- Move all your function declarations into the modules under the
./libdirectory (./lib/print_bar.sh and ./lib/print_foo.sh in this example); - Copy the content of the Makefile to the root of your project;
Build
- Replace the value of the variable
TARGET_FILEin theMakefile(wich istarget.shby default) with the name that your prefer; - Run
makefrom your project directory; - The content of your
main.shfile will be wrapped into themainfunction and will be invoked at the end of the script, so all of the functions defined in modules under thelibdirectory will be available in it;
Changelog
0.1
- Created the initial script
- Split it up so it will compile itself (this therefor serves as example project)
Sources
Description
Languages
Shell
100%