# check for headless mode
HEADLESS=0
+GUI=0
+HELP=0
+DEBUG=0
for ARG in "${@}"; do
- if [ "${ARG}" = "--headless" ]; then
+ case "${ARG}" in
+ "--headless")
+ HEADLESS=1
+ ;;
+ "--help")
+ HELP=1
+ ;;
+ --help-*)
+ HELP=1
+ ;;
+ "--gui")
+ GUI=1
+ ;;
+ "--debug")
+ DEBUG=1
+ ;;
+ esac
+
+ if [ "${HELP}" = 1 ]; then
+ # --help takes precedence
HEADLESS=1
- elif [ "${ARG}" = "--gui" ]; then
+ GUI=0
+ elif [ "${GUI}" = 1 ]; then
# --gui takes precedence over --headless
HEADLESS=0
- break
fi
done
if [ "${ISMACOS}" = 1 ]; then
# MACOS ONLY
DIR="$(dirname "$(readlinkf "$0")")"
- APP="${DIR%.app/Contents/*}".app
- if [ "${APP}" = "${APP%.app}" ]; then
- echo "Could not find Jalview.app" >&2
- exit 2
- fi
- APPDIR="${APP}/Contents/Resources/app"
+ APPDIR="${DIR%/bin}"
JAVA="${APPDIR}/jre/Contents/Home/bin/java"
JVMARGS=( "${JVMARGS[@]}" "-Xdock:icon=${APPDIR}/resource/jalview_logo.png" )
else
echo "Cannot find bundled java, using system ${JAVA} and hoping for the best!" >&2
fi
+if [ "${DEBUG}" = 1 ]; then
+ echo Shell running: \""${JAVA}"\" \""${JVMARGS[@]}"\" -cp \""${CLASSPATH}"\" jalview.bin.Launcher "${ARGS[@]}"
+fi
+
"${JAVA}" "${JVMARGS[@]}" -cp "${CLASSPATH}" jalview.bin.Launcher "${ARGS[@]}"