54 lines
880 B
Bash
54 lines
880 B
Bash
|
#!/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
|
||
|
}
|
||
|
|
||
|
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
|
||
|
|
||
|
runIt() { eval "$1" " $args"; }
|
||
|
|
||
|
if [ "$run" = true ]; then
|
||
|
if [ -f $defaultBinLocation ]; then
|
||
|
runIt "$defaultBinLocation"
|
||
|
elif [ -f ybcon ]; then
|
||
|
runIt "./ybcon"
|
||
|
fi
|
||
|
fi
|