dotfiles/.local/bin/scripts/retest

11 lines
364 B
Plaintext
Raw Normal View History

#!/bin/sh
# Execute a gradle task (default test) until it fails
code=0
case "$1" in ([0-9]*) code=$1; shift;; esac
task="${1:-test}"
test $# -gt 1 && prefix=":$2:"
gradle=$(test -x "./gradlew" && echo "./gradlew" || echo "gradle")
( exit $code ); while test $? -eq $code; do $gradle ${prefix}clean$(echo $task | sed -e 's/^./\U&/') ${prefix}$task "${@:3}"; done