#!/usr/bin/env sh # Do - The Simplest Build Tool on Earth. # Documentation and examples see https://github.com/8gears/do # shellcheck disable=SC2039 set -Eeuo pipefail # -e "Automatic exit from bash shell script on error" -u "Treat unset variables and parameters as errors" _install_location() { # shellcheck disable=SC2016 wolframscript -c 'FileNameJoin[{StringReplace[$UserBaseDirectory, "\\" -> "/"], "Applications", "owenScalapinoFreeEnergy"}, OperatingSystem -> "Unix"]' | tr -d '\r\n' } install() { # shellcheck disable=SC2039 local install_loc install_loc=$(_install_location) echo "Installing to [$install_loc]" mkdir -p "$install_loc" cp src/wl/owenScalapinoFreeEnergy.wl "$install_loc" } all() { install } test() { echo "I am ${FUNCNAME[0]}ing" wolframscript -f src/wltest/RunTests.wls } "$@" # <- execute the task [ "$#" -gt 0 ] || printf "Usage:\n\t./do.sh %s\n" "($(compgen -A function | grep '^[^_]' | paste -sd '|' -))"