Skip to content

Commit ddb285c

Browse files
committed
Add custom classpath scala#3477
1 parent 6e66cd6 commit ddb285c

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

dist/bin/dotr

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,39 @@ source "$PROG_HOME/bin/common"
3131

3232
CLASS_PATH=".$PSEP$DOTTY_LIB$PSEP$SCALA_LIB"
3333

34-
# -d must be the first option
35-
case "$1" in
36-
-d) DEBUG="$DEBUG_STR" && shift ;;
37-
esac
3834

39-
first_arg="$1"
35+
addResidual () {
36+
residual_args+=("$1")
37+
}
4038

41-
if [ -z "$1" ]; then
39+
run_repl=true
40+
run_app=flase
41+
while [[ $# -gt 0 ]]; do
42+
key=$1
43+
case $key in
44+
-repl)
45+
run_repl=true
46+
shift
47+
;;
48+
-classpath)
49+
CLASS_PATH+=":$2"
50+
shift
51+
shift
52+
;;
53+
*)
54+
addResidual "$1"
55+
shift
56+
;;
57+
-d)
58+
DEBUG="$DEBUG_STR"
59+
shift
60+
;;
61+
esac
62+
done
63+
64+
if [ -z $residual_args ]; then
4265
echo "Starting dotty REPL..."
4366
eval "$PROG_HOME/bin/dotc -repl"
44-
elif [[ ${first_arg:0:1} == "-" ]]; then
45-
eval "$PROG_HOME/bin/dotc -repl $@"
4667
else
47-
eval exec "\"$JAVACMD\"" "$DEBUG" "-classpath \"$CLASS_PATH\"" $@
68+
eval exec "\"$JAVACMD\"" "$DEBUG" "-classpath \"$CLASS_PATH\"" "${residual_args[@]}"
4869
fi

0 commit comments

Comments
 (0)