add failure wall command '--'

This commit is contained in:
Mark Harrah 2010-09-05 11:16:53 -04:00
parent 6b4844094a
commit 018ef2b3c7
3 changed files with 20 additions and 5 deletions

View File

@ -160,6 +160,8 @@ CompileSyntax + """
Compiled classes will be written to the 'classes' directory.
Cached information about the compilation will be written to 'cache'.
"""
val FailureWall = "--"
def Load = "load"
def LoadLabel = "a project"

View File

@ -61,9 +61,13 @@ class xMain extends xsbti.AppMain
import CommandSupport._
object Commands
{
def DefaultCommands = Seq(help, reload, read, history, exit, load, loadCommands, compile, discover,
def DefaultCommands = Seq(ignore, help, reload, read, history, exit, load, loadCommands, compile, discover,
projects, project, setOnFailure, ifLast, multi, shell, alias, append, act)
def ignore = nothing(Set(FailureWall))
def nothing(ignore: Set[String]) = Command.univ { s => Apply(){ case in if ignore(in.line) => s } }
def applicable(state: State): Stream[Apply] =
state.processors.toStream.flatMap(_.applies(state) )

View File

@ -3,7 +3,8 @@
*/
package sbt
import java.io.File
import java.io.File
import CommandSupport.FailureWall
case class State(project: Any)(
val configuration: xsbti.AppConfiguration,
@ -50,10 +51,18 @@ object State
def get[T](key: AttributeKey[T]) = s.attributes.get(key)
def put[T](key: AttributeKey[T], value: T) = s.copy()(attributes = s.attributes.put(key, value))
def fail =
s.onFailure match
{
val remaining = s.commands.dropWhile(_ != FailureWall)
if(remaining.isEmpty)
{
case Some(c) => s.copy()(commands = c :: Nil, onFailure = None)
case None => exit(ok = false)
s.onFailure match
{
case Some(c) => s.copy()(commands = c :: Nil, onFailure = None)
case None => exit(ok = false)
}
}
else
s.copy()(commands = remaining)
}
}
}