2021-02-25 17:57:49 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# ybcon start script
|
|
|
|
|
|
|
|
EXENAME=ybcon
|
|
|
|
|
|
|
|
# Default location of the executable
|
|
|
|
defaultBinLocation=/opt/bin/ybcon
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
echo "$EXENAME [-h|--help] [-p|-printresult] file"
|
|
|
|
echo " -h or --help What you're seeing right now"
|
|
|
|
echo " -p or -printresult Prints the transpilation result to stdout"
|
|
|
|
}
|
|
|
|
|
|
|
|
args="";
|
|
|
|
run=false;
|
|
|
|
|
|
|
|
newArgs() {
|
|
|
|
if [ "$args" = "" ]; then
|
|
|
|
args="$args$1"
|
|
|
|
else
|
|
|
|
args="$args $1"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-02-25 18:51:03 +01:00
|
|
|
if [ "$#" != 0 ]; then
|
|
|
|
for it in "$@"
|
|
|
|
do
|
|
|
|
case "$it" in
|
|
|
|
-h | --help )
|
|
|
|
echo "Usage:"
|
|
|
|
usage
|
|
|
|
exit 0 ;;
|
|
|
|
-p | -printresult )
|
|
|
|
newArgs "$it"
|
|
|
|
shift ;;
|
|
|
|
*.ybcon )
|
|
|
|
newArgs "$it"
|
|
|
|
run=true
|
|
|
|
break ;;
|
|
|
|
* )
|
|
|
|
usage ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
else
|
|
|
|
usage
|
|
|
|
fi
|
2021-02-25 17:57:49 +01:00
|
|
|
|
|
|
|
runIt() { eval "$1" " $args"; }
|
|
|
|
|
|
|
|
if [ "$run" = true ]; then
|
|
|
|
if [ -f $defaultBinLocation ]; then
|
|
|
|
runIt "$defaultBinLocation"
|
|
|
|
elif [ -f ybcon ]; then
|
|
|
|
runIt "./ybcon"
|
|
|
|
fi
|
|
|
|
fi
|