minor rework of main class selection

This commit is contained in:
Mark Harrah 2010-09-27 18:52:13 -04:00
parent 1917809617
commit 1e11ef13cd
1 changed files with 3 additions and 4 deletions

View File

@ -6,15 +6,14 @@ package sbt
object SelectMainClass
{
// Some(SimpleReader.readLine _)
def apply(promptIfMultipleChoices: Option[String => Option[String]], mainClasses: List[String]) =
def apply(promptIfMultipleChoices: Option[String => Option[String]], mainClasses: Seq[String]): Option[String] =
{
mainClasses match
mainClasses.toList match
{
case Nil => None
case head :: Nil => Some(head)
case multiple =>
for(prompt <- promptIfMultipleChoices) yield
{
promptIfMultipleChoices flatMap { prompt =>
println("\nMultiple main classes detected, select one to run:\n")
for( (className, index) <- multiple.zipWithIndex )
println(" [" + (index+1) + "] " + className)