Bashembler -- contraction for bash-assembler -- aims to ease shell scripts
development by providing a way to split lengthy scripts in multiple files
included by source
or .
(dot) instructions, and assembling these files
in a final single-file script, ready for deployment.
Process script.bash
and output the result to stdout
:
bashembler 'script.bash'
# Using docker
docker run --rm --volume '.:/data' 'biapy/bashembler' 'script.bash'
Process script.sh
and store result in bin/script-for-deployment
:
bashembler --output='bin/script-for-deployment' 'script.bash'
# Using docker
docker run --rm --volume '.:/data' 'biapy/bashembler' \
--output='bin/script-for-deployment' 'script.bash'
Optionally, strip comments from result:
bashembler --discard-comments 'script.bash'
# Using docker
docker run --rm --volume '.:/data' 'biapy/bashembler' \
--discard-comments 'script.bash'
Bashembler makes use of:
- Biapy bashlings.
- shdoc for building markdown documentation from code.
- Pandoc for creating
man
page. - ShellCheck for checking code quality.
- shfmt for formating scripts.
- ShellSpec for unit testing.
This library uses the ShellSpec library for unit-testing.
Clone the repository with the additionnal libraries:
git clone --recurse-submodules '[email protected]:biapy/bashembler'
Update the submodules with:
git submodule update --remote
The Makefile
provides these rules:
- help : Display a short help message about the rules available in the
Makefile
. - clean : Delete generated documentation in
doc/
and remove functions list fromREADME.md
. - format : format files using
shfmt
on*.bash
files insrc/
and*.bats
files intest/
. - check : check files for errors using
shellcheck
on*.bash
files insrc/
. - test : run unit tests.
- doc : Generate documentation in
doc/
usingshdoc
. - all : All of the above.