File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 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"
4040declare -a residual_args
4141execute_repl=false
4242execute_run=false
43+ execute_script=false
4344with_compiler=false
4445class_path_count=0
46+ is_at_first_residual_argument=true
4547CLASS_PATH=" "
4648
4749# Little hack to check if all arguments are options
@@ -79,17 +81,27 @@ while [[ $# -gt 0 ]]; do
7981 addDotcOptions " ${1} "
8082 shift ;;
8183 * )
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
8289 residual_args+=(" $1 " )
8390 shift
8491 ;;
8592
8693 esac
8794done
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
8997 if [ " $CLASS_PATH " ]; then
9098 cp_arg=" -classpath \" $CLASS_PATH \" "
9199 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
93105 eval " \" $PROG_HOME /bin/scalac\" $cp_arg ${java_options[@]} -repl ${residual_args[@]} "
94106elif [ $execute_repl == true ] || [ ${# residual_args[@]} -ne 0 ]; then
95107 cp_arg=" $DOTTY_LIB$PSEP$SCALA_LIB "
You can’t perform that action at this time.
0 commit comments