Fix interactive detection in Main

This commit is contained in:
Mark Harrah 2009-10-23 08:45:58 -04:00
parent ecea2f2ed6
commit 308bbc4724
1 changed files with 4 additions and 4 deletions

8
src/main/scala/sbt/Main.scala Normal file → Executable file
View File

@ -119,16 +119,16 @@ class xMain extends xsbti.AppMain
{
def process(project: Project, arguments: List[String], isInteractive: Boolean): xsbti.MainResult =
{
def saveProject(newArgs: List[String]) = if(baseProject.name != project.name) (ProjectAction + " " + project.name) :: newArgs else newArgs
def rememberCurrent(newArgs: List[String]) = if(baseProject.name != project.name) (ProjectAction + " " + project.name) :: newArgs else newArgs
arguments match
{
case "" :: tail => process(project, tail, isInteractive)
case (ExitCommand | QuitCommand) :: _ => Exit(NormalExitCode)
case RebootCommand :: tail => Reboot(project.defScalaVersion.value, saveProject(tail), configuration)
case RebootCommand :: tail => Reboot(project.defScalaVersion.value, rememberCurrent(tail), configuration)
case InteractiveCommand :: _ => process(project, prompt(baseProject, project) :: arguments, true)
case SpecificBuild(version, action) :: tail =>
if(Some(version) != baseProject.info.buildScalaVersion)
throw new ReloadException(saveProject(action :: tail), Some(version))
throw new ReloadException(rememberCurrent(action :: tail), Some(version))
else
process(project, action :: tail, isInteractive)
case CrossBuild(action) :: tail =>
@ -147,7 +147,7 @@ class xMain extends xsbti.AppMain
case Nil => project.log.error("Invalid internal sbt state: no arguments"); Exit(ProgramErrorExitCode)
}
}
process(baseProject, arguments, false)
process(baseProject, arguments, arguments.lastOption == Some(InteractiveCommand))
}
object SetProject
{