mirror of https://github.com/sbt/sbt.git
Merge pull request #4023 from dwijnand/reintroduce-Command.process
Re-introduce Command.process
This commit is contained in:
commit
dfbb67e7d6
|
|
@ -163,6 +163,16 @@ object Command {
|
|||
case Some(c) => c(state)
|
||||
})
|
||||
|
||||
def process(command: String, state: State): State = {
|
||||
val parser = combine(state.definedCommands)
|
||||
parse(command, parser(state)) match {
|
||||
case Right(s) => s() // apply command. command side effects happen here
|
||||
case Left(errMsg) =>
|
||||
state.log error errMsg
|
||||
state.fail
|
||||
}
|
||||
}
|
||||
|
||||
def invalidValue(label: String, allowed: Iterable[String])(value: String): String =
|
||||
s"Not a valid $label: $value" + similar(value, allowed)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import scala.util.control.NonFatal
|
|||
|
||||
import sbt.io.{ IO, Using }
|
||||
import sbt.internal.util.{ ErrorHandling, GlobalLogBacking }
|
||||
import sbt.internal.util.complete.Parser
|
||||
import sbt.internal.langserver.ErrorCodes
|
||||
import sbt.util.Logger
|
||||
import sbt.protocol._
|
||||
|
|
@ -148,13 +147,7 @@ object MainLoop {
|
|||
val channelName = exec.source map (_.channelName)
|
||||
StandardMain.exchange publishEventMessage
|
||||
ExecStatusEvent("Processing", channelName, exec.execId, Vector())
|
||||
val parser = Command combine state.definedCommands
|
||||
val newState = Parser.parse(exec.commandLine, parser(state)) match {
|
||||
case Right(s) => s() // apply command. command side effects happen here
|
||||
case Left(errMsg) =>
|
||||
state.log error errMsg
|
||||
state.fail
|
||||
}
|
||||
val newState = Command.process(exec.commandLine, state)
|
||||
val doneEvent = ExecStatusEvent(
|
||||
"Done",
|
||||
channelName,
|
||||
|
|
|
|||
Loading…
Reference in New Issue