mirror of https://github.com/sbt/sbt.git
minor rework of main class selection
This commit is contained in:
parent
1917809617
commit
1e11ef13cd
|
|
@ -6,15 +6,14 @@ package sbt
|
||||||
object SelectMainClass
|
object SelectMainClass
|
||||||
{
|
{
|
||||||
// Some(SimpleReader.readLine _)
|
// 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 Nil => None
|
||||||
case head :: Nil => Some(head)
|
case head :: Nil => Some(head)
|
||||||
case multiple =>
|
case multiple =>
|
||||||
for(prompt <- promptIfMultipleChoices) yield
|
promptIfMultipleChoices flatMap { prompt =>
|
||||||
{
|
|
||||||
println("\nMultiple main classes detected, select one to run:\n")
|
println("\nMultiple main classes detected, select one to run:\n")
|
||||||
for( (className, index) <- multiple.zipWithIndex )
|
for( (className, index) <- multiple.zipWithIndex )
|
||||||
println(" [" + (index+1) + "] " + className)
|
println(" [" + (index+1) + "] " + className)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue