Skip to content

Commit 0ab6793

Browse files
NIT Small refacto
1 parent 6bc6cbf commit 0ab6793

File tree

1 file changed

+16
-8
lines changed
  • modules/cli/src/main/scala/scala/cli/commands

1 file changed

+16
-8
lines changed

modules/cli/src/main/scala/scala/cli/commands/Repl.scala

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@ object Repl extends ScalaCommand[ReplOptions] {
117117
case Right(()) =>
118118
}
119119
}
120+
def doRunReplFromBuild(
121+
build: Build.Successful,
122+
allowExit: Boolean
123+
): Unit =
124+
doRunRepl(
125+
build.options,
126+
build.artifacts,
127+
build.outputOpt,
128+
allowExit
129+
)
120130

121131
val cross = options.sharedRepl.compileCross.cross.getOrElse(false)
122132
val configDb = options.shared.configDb
@@ -154,10 +164,9 @@ object Repl extends ScalaCommand[ReplOptions] {
154164
) { res =>
155165
for (builds <- res.orReport(logger))
156166
builds.main match {
157-
case s: Build.Successful =>
158-
doRunRepl(s.options, s.artifacts, s.outputOpt, allowExit = false)
159-
case _: Build.Failed => buildFailed(allowExit = false)
160-
case _: Build.Cancelled => buildCancelled(allowExit = false)
167+
case s: Build.Successful => doRunReplFromBuild(s, allowExit = false)
168+
case _: Build.Failed => buildFailed(allowExit = false)
169+
case _: Build.Cancelled => buildCancelled(allowExit = false)
161170
}
162171
}
163172
try WatchUtil.waitForCtrlC()
@@ -178,10 +187,9 @@ object Repl extends ScalaCommand[ReplOptions] {
178187
)
179188
.orExit(logger)
180189
builds.main match {
181-
case s: Build.Successful =>
182-
doRunRepl(s.options, s.artifacts, s.outputOpt, allowExit = true)
183-
case _: Build.Failed => buildFailed(allowExit = true)
184-
case _: Build.Cancelled => buildCancelled(allowExit = true)
190+
case s: Build.Successful => doRunReplFromBuild(s, allowExit = true)
191+
case _: Build.Failed => buildFailed(allowExit = true)
192+
case _: Build.Cancelled => buildCancelled(allowExit = true)
185193
}
186194
}
187195
}

0 commit comments

Comments
 (0)