@@ -27,6 +27,7 @@ case class Settings(
27
27
scriptArgs : List [String ] = List .empty,
28
28
targetScript : String = " " ,
29
29
save : Boolean = false ,
30
+ modeShouldBeRun : Boolean = false ,
30
31
) {
31
32
def withExecuteMode (em : ExecuteMode ): Settings = this .executeMode match
32
33
case ExecuteMode .Guess =>
@@ -58,6 +59,9 @@ case class Settings(
58
59
59
60
def withSave : Settings =
60
61
this .copy(save = true )
62
+
63
+ def withModeShouldBeRun : Settings =
64
+ this .copy(modeShouldBeRun = true )
61
65
}
62
66
63
67
object MainGenericRunner {
@@ -99,7 +103,8 @@ object MainGenericRunner {
99
103
.withTargetScript(arg)
100
104
.withScriptArgs(tail* )
101
105
else
102
- process(tail, settings.withResidualArgs(arg))
106
+ val newSettings = if arg.startsWith(" -" ) then settings else settings.withModeShouldBeRun
107
+ process(tail, newSettings.withResidualArgs(arg))
103
108
104
109
def main (args : Array [String ]): Unit =
105
110
val settings = process(args.toList, Settings ())
@@ -127,10 +132,10 @@ object MainGenericRunner {
127
132
++ settings.scriptArgs
128
133
scripting.Main .main(properArgs.toArray)
129
134
case ExecuteMode .Guess =>
130
- if args.toList.forall(_.startsWith(" -" )) then // all are options
131
- run(ExecuteMode .Repl )
132
- else
135
+ if settings.modeShouldBeRun then
133
136
run(ExecuteMode .Run )
137
+ else
138
+ run(ExecuteMode .Repl )
134
139
135
140
run(settings.executeMode)
136
141
0 commit comments