mirror of
https://github.com/sbt/sbt.git
synced 2026-09-01 02:27:13 +02:00
Move JLine apis into LineReader
It is better that sbt not expose the implementation detail that LineReader is implemented by JLine. Other terminal related apis should be handled by sbt.internal.util.Terminal.
This commit is contained in:
@@ -9,7 +9,7 @@ package sbt
|
||||
|
||||
import java.nio.file.Paths
|
||||
import sbt.util.Level
|
||||
import sbt.internal.util.{ AttributeKey, FullReader, JLine, Terminal }
|
||||
import sbt.internal.util.{ AttributeKey, FullReader, LineReader, Terminal }
|
||||
import sbt.internal.util.complete.{
|
||||
Completion,
|
||||
Completions,
|
||||
@@ -34,7 +34,9 @@ import BasicKeys._
|
||||
import java.io.File
|
||||
|
||||
import sbt.io.IO
|
||||
import sbt.util.Level
|
||||
|
||||
import scala.Function.tupled
|
||||
import scala.collection.mutable.ListBuffer
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
@@ -374,7 +376,7 @@ object BasicCommands {
|
||||
val history = (s get historyPath) getOrElse (new File(s.baseDir, ".history")).some
|
||||
val prompt = (s get shellPrompt) match { case Some(pf) => pf(s); case None => "> " }
|
||||
val reader =
|
||||
new FullReader(history, s.combinedParser, JLine.HandleCONT, Terminal.wrappedSystemIn)
|
||||
new FullReader(history, s.combinedParser, LineReader.HandleCONT, Terminal.wrappedSystemIn)
|
||||
val line = reader.readLine(prompt)
|
||||
line match {
|
||||
case Some(line) =>
|
||||
|
||||
@@ -29,7 +29,12 @@ private[sbt] final class ConsoleChannel(val name: String) extends CommandChannel
|
||||
private val history = s.get(historyPath).getOrElse(Some(new File(s.baseDir, ".history")))
|
||||
private val prompt = getPrompt(s)
|
||||
private val reader =
|
||||
new FullReader(history, s.combinedParser, JLine.HandleCONT, Terminal.throwOnClosedSystemIn)
|
||||
new FullReader(
|
||||
history,
|
||||
s.combinedParser,
|
||||
LineReader.HandleCONT,
|
||||
Terminal.throwOnClosedSystemIn
|
||||
)
|
||||
setDaemon(true)
|
||||
start()
|
||||
override def run(): Unit =
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.concurrent.atomic.{ AtomicBoolean, AtomicReference }
|
||||
|
||||
import sbt.internal.langserver.{ LogMessageParams, MessageType, PublishDiagnosticsParams }
|
||||
import sbt.internal.protocol._
|
||||
import sbt.internal.util.{ ConsoleAppender, JLine }
|
||||
import sbt.internal.util.{ ConsoleAppender, LineReader }
|
||||
import sbt.io.IO
|
||||
import sbt.io.syntax._
|
||||
import sbt.protocol._
|
||||
@@ -216,7 +216,7 @@ class NetworkClient(configuration: xsbti.AppConfiguration, arguments: List[Strin
|
||||
}
|
||||
|
||||
def shell(): Unit = {
|
||||
val reader = JLine.simple(None, JLine.HandleCONT, injectThreadSleep = true)
|
||||
val reader = LineReader.simple(None, LineReader.HandleCONT, injectThreadSleep = true)
|
||||
while (running.get) {
|
||||
reader.readLine("> ", None) match {
|
||||
case Some("shutdown") =>
|
||||
|
||||
Reference in New Issue
Block a user