diff options
| -rwxr-xr-x | scripts/build.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..9ab3b17 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,38 @@ +#!/bin/zsh + +desired_build_file=${1:-all} +desired_format=${2:-pdf} +built_in_all="all" + +build_base_command() { + local command_builder="chordpro" + local file_name=$1 + local file_type=$2 + + command_builder="$command_builder --config=$PWD/config.json" + + if [[ -f "$PWD/configs/$file_name.json" ]] ; then + command_builder="$command_builder --config=$PWD/configs/$file_name.json" + fi + + command_builder="$command_builder $PWD/src/$file_name.chordpro" + command_builder="$command_builder -o $PWD/out/$file_name.$file_type" + + echo "" + echo "Starting $file_name" + echo "" + echo $command_builder + echo "" + eval ${command_builder} +} + +render_all() { + for file in $PWD/src/**/*(.); do build_base_command $file:t:r $desired_format:l; done +} + +echo "Interpreted as request to build '${desired_build_file:l}' as '${desired_format:l}'" +if [[ $desired_build_file:l == $built_in_all:l ]] ; then + render_all +else + build_base_command $desired_build_file:l $desired_format:l +fi |
