File tree 1 file changed +14
-2
lines changed 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -40,8 +40,10 @@ source "$PROG_HOME/bin/common"
40
40
declare -a residual_args
41
41
execute_repl=false
42
42
execute_run=false
43
+ execute_script=false
43
44
with_compiler=false
44
45
class_path_count=0
46
+ is_at_first_residual_argument=true
45
47
CLASS_PATH=" "
46
48
47
49
# Little hack to check if all arguments are options
@@ -79,17 +81,27 @@ while [[ $# -gt 0 ]]; do
79
81
addDotcOptions " ${1} "
80
82
shift ;;
81
83
* )
84
+ if [ $is_at_first_residual_argument == true ] && [[ " $1 " == * .scala ]]; then
85
+ execute_script=true
86
+ target_script=" $1 "
87
+ fi
88
+ is_at_first_residual_argument=false
82
89
residual_args+=(" $1 " )
83
90
shift
84
91
;;
85
92
86
93
esac
87
94
done
88
- if [ $execute_repl == true ] || ([ $execute_run == false ] && [ $options_indicator == 0 ]); then
95
+
96
+ if [ $execute_repl == true ] || [ $execute_script == true ] || ([ $execute_run == false ] && [ $options_indicator == 0 ]); then
89
97
if [ " $CLASS_PATH " ]; then
90
98
cp_arg=" -classpath \" $CLASS_PATH \" "
91
99
fi
92
- echo " Starting scala3 REPL..."
100
+ if [ $execute_script == true ]; then
101
+ echo " Running script $target_script "
102
+ else
103
+ echo " Starting scala3 REPL..."
104
+ fi
93
105
eval " \" $PROG_HOME /bin/scalac\" $cp_arg ${java_options[@]} -repl ${residual_args[@]} "
94
106
elif [ $execute_repl == true ] || [ ${# residual_args[@]} -ne 0 ]; then
95
107
cp_arg=" $DOTTY_LIB$PSEP$SCALA_LIB "
You can’t perform that action at this time.
0 commit comments