dotfiles/.local/bin/scripts/retest

14 lines
356 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"; expr gradle \& $? \| ./gradlew)
( exit $code )
while test $? -eq $code
do $gradle ${prefix}clean$(echo $task | sed -e 's/^./\U&/') ${prefix}$task "${@:3}"
done