#!/usr/bin/env bash

cd "$( dirname $0 )/.."

suffix=""
if [ "$1" == "--with-testing" ]; then
    suffix="[testing]"
fi

./bin/py-depgraph |
    grep -- '->' |
    sed -e 's/[";]//g' -e 's/->//g' -e 's/\[.*$//g' |
    tsort |
    tac |
    grep '^swh\.' |
    sed 's:\.:-:g' |
    sed 's:^:-e :' |
    sed "s/$/$suffix/" |
    sed 's/\]\[/,/g'
