# WINDOWS ONLY (Cygwin or WSL)
# change paths for Cygwin or Windows Subsystem for Linux (WSL)
-if [ "${ISMACOS}" != 1 ]; then # macos doesn't like uname -o, best to avoid
+if [ "${ISMACOS}" != 1 ]; then # older macos doesn't like uname -o, best to avoid
if [ "$(uname -o)" = "Cygwin" ]; then
# CYGWIN
echo "When using relative paths in args within Cygwin, please start with './' or '../'" >&2
fi
fi
+# get console width -- three ways to try, just in case
+if command -v tput 2>&1 >/dev/null; then
+ COLUMNS=$(tput cols) 2>/dev/null
+elif command -v stty 2>&1 >/dev/null; then
+ COLUMNS=$(stty size | cut -d" " -f2) 2>/dev/null
+elif command -v resize 2>&1 >/dev/null; then
+ COLUMNS=$(resize -u | grep COLUMNS= | sed -e 's/.*=//;s/;//') 2>/dev/null
+fi
+JVMARGS=( "${JVMARGS[@]}" "-DCONSOLEWIDTH=${COLUMNS}" )
+
# Is there a bundled Java? If not just try one in the PATH (do need .exe in WSL)
if [ \! -e "${JAVA}" ]; then
JAVA=$SYSJAVA
echo "Cannot find bundled java, using system ${JAVA} and hoping for the best!" >&2
fi
-# check to see if $1 is set and is not start of other cli args
-OPEN=""
-if [ -n "${ARG1}" -a "${ARG1}" = "${ARG1#-}" -a "${ARG1}" != "open" ]; then
- # first argument exists and does not start with a "-" and is not "open"
- OPEN="-open"
-fi
-
-# don't quote $OPEN (don't want it accidentally mistaken as an empty string arg!)
-"${JAVA}" "${JVMARGS[@]}" -cp "${CLASSPATH}" jalview.bin.Launcher ${OPEN} "${ARGS[@]}"
+"${JAVA}" "${JVMARGS[@]}" -cp "${CLASSPATH}" jalview.bin.Launcher "${ARGS[@]}"