Say goodbye to shellscript boilerplate. The following options are set:
set -ETeo pipefail
shopt -s dotglob extglob globasciiranges globstar lastpipe shift_verbose noexpand_translation
export LANG='C' LC_CTYPE='C' ... LC_ALL='C'
Set variables as you would with make; there are additional constraints. Variables that are all caps such as CC
can be directly accessed; otherwise, the name is prefixed with var_
. Like so:
bake CC=gcc should_eat=yes run
task.run() {
printf '%s\n' "$CC" "$var_should_eat"
}
Bash sets various environment variables
BAKE_FILE
: the absolute path of theBakefile.sh
being used for running tasks.BAKE_ROOT
: the absolute path of the directory containingBAKE_FILE
. This has the same value asPWD
at the start of a task.BAKE_OLDPWD
: the original directory where bake was invoced from.
- A
bake
script is always created (and optionally updated) adjacent toBakefile.sh
. This allows the
Set configuration values through comments like so:
#config: stacktrace big-print=off
task.docs() {
:
}
If no value is given, it defaults to on
. There are several keys:
As tite
RUNNING TASK
We have init()
function for repetitive things to do on each invocation (set -e
, etc.)
We track time and when task ends, we print total time of execution
It's super easy to make a Bake task automatically reload on a file change. Simply use the -w
flag:
#watch: --ignore main
task.buld() {
"${CC:-gcc}" -o main "$@" main.cpp
}
bake -w build