#! /bin/bash -e

. usage.sh

for p in $@; do

	if [ $p = "-help" ] || [ $p = "-h" ]; then
    	usage faust2svg "<file.dsp>"
    	echo "Compiles Faust programs to SVG"
    	exit
    fi
    
    if [[ -f "$p" ]] && [ ${p: -4} == ".dsp" ]; then
        FILES="$FILES $p"
    else
        OPTIONS="$OPTIONS $p"        
    fi
    
done

for f in $FILES; do
    faust $OPTIONS -t 0 -svg $@ -o /dev/null
done

