forked from jline/jline3
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjline-gogo.sh
executable file
·110 lines (101 loc) · 2.98 KB
/
jline-gogo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/sh
realpath() {
OURPWD=${PWD}
cd "$(dirname "${1}")"
LINK=$(readlink "$(basename "${1}")")
while [ "${LINK}" ]; do
cd "$(dirname "${LINK}")"
LINK=$(readlink "$(basename "${1}")")
done
REALPATH="${PWD}/$(basename "${1}")"
cd "${OURPWD}"
echo "${REALPATH}"
}
REALNAME=$(realpath "$0")
DIRNAME=$(dirname "${REALNAME}")
PROGNAME=$(basename "${REALNAME}")
ROOTDIR=${DIRNAME}/..
TARGETDIR=${DIRNAME}/target
if [ ! -e ${TARGETDIR}/lib ] ; then
echo "Build jline with maven before running the demo"
exit
fi;
cp=${TARGETDIR}/classes
# JLINE
cp=${cp}$(find ${TARGETDIR}/lib -name "jline-*.jar" -exec printf :{} ';')
# Gogo Runtime
cp=${cp}$(find ${TARGETDIR}/lib -name "org.apache.felix.gogo.runtime-*.jar" -exec printf :{} ';')
# Gogo JLine
cp=${cp}$(find ${TARGETDIR}/lib -name "org.apache.felix.gogo.jline-*.jar" -exec printf :{} ';')
opts="${JLINE_OPTS}"
logconf="${DIRNAME}/etc/logging.properties"
while [ "${1}" != "" ]; do
case ${1} in
'debug')
opts="${opts} -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
shift
;;
'debugs')
opts="${opts} -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005"
shift
;;
'jansi')
cp=${cp}$(find ${TARGETDIR}/lib -name "jansi-*.jar" -exec printf :{} ';')
shift
;;
'jna')
cp=${cp}$(find ${TARGETDIR}/lib -name "jna-*.jar" -exec printf :{} ';')
shift
;;
'ssh' | 'telnet' | 'remote')
cp=${cp}$(find ${TARGETDIR}/lib -name "sshd-common-*.jar" -exec printf :{} ';')
cp=${cp}$(find ${TARGETDIR}/lib -name "sshd-core-*.jar" -exec printf :{} ';')
cp=${cp}$(find ${TARGETDIR}/lib -name "sshd-scp-*.jar" -exec printf :{} ';')
cp=${cp}$(find ${TARGETDIR}/lib -name "sshd-sftp-*.jar" -exec printf :{} ';')
cp=${cp}$(find ${TARGETDIR}/lib -name "slf4j-api-*.jar" -exec printf :{} ';')
cp=${cp}$(find ${TARGETDIR}/lib -name "slf4j-jdk14-*.jar" -exec printf :{} ';')
shift
;;
'verbose')
logconf="${DIRNAME}/etc/logging-verbose.properties"
shift
;;
'ffm')
opts="${opts} --enable-preview --enable-native-access=ALL-UNNAMED"
shift
;;
*)
opts="${opts} ${1}"
shift
;;
esac
done
cygwin=false
mingw=false
case "$(uname)" in
CYGWIN*)
cygwin=true
;;
MINGW*)
mingw=true
;;
esac
if ${cygwin}; then
cp=$(cygpath --path --windows "${cp}")
DIRNAME=$(cygpath --path --windows "${DIRNAME}")
fi
nothing() {
# nothing to do here
a=a
}
trap 'nothing' TSTP
# Launch gogo shell
echo "Launching Gogo JLine..."
echo "Classpath: $cp"
set mouse=a
java -cp $cp \
--enable-preview \
$opts \
-Dgosh.home="${DIRNAME}" \
-Djava.util.logging.config.file="${logconf}" \
org.apache.felix.gogo.jline.Main