#!/bin/sh
#
# @author Klemens Böswirth <k.boeswirth+git@gmail.com>
# @brief Calls all other reformat scripts
# @date 29.03.2019
# @tags reformat

DEV_SCRIPTS_DIR=$(dirname "$0")
. "${DEV_SCRIPTS_DIR}/include-common"

cd "$SOURCE"

reformat() {
	reformat=$1
	shift
	echo "starting $reformat ..."
	"$reformat" "$@"
	echo "finished $reformat"
}

OLD_IFS="$IFS"
IFS='
'
for reformat in $(ls "$DEV_SCRIPTS_DIR"/reformat-*); do
	[ "$(basename "$reformat")" = "reformat-all" ] && continue
	reformat "$reformat" "$@" &
	PIDS="$PIDS $!"
done
IFS="$OLD_IFS"

for pid in $PIDS; do
	wait "$pid"
done
