more release-worthy compile message and analysis toString

This commit is contained in:
Mark Harrah 2011-05-29 19:17:31 -04:00
parent fa90cc7de6
commit f0608da0a8
2 changed files with 9 additions and 2 deletions

View File

@ -3,7 +3,7 @@
*/
package sbt
object Collections
object Util
{
def separate[T,A,B](ps: Seq[T])(f: T => Either[A,B]): (Seq[A], Seq[B]) =
((Nil: Seq[A], Nil: Seq[B]) /: ps)( (xs, y) => prependEither(xs, f(y)) )
@ -14,4 +14,11 @@ object Collections
case Left(l) => (l +: acc._1, acc._2)
case Right(r) => (acc._1, r +: acc._2)
}
def counted(prefix: String, single: String, plural: String, count: Int): Option[String] =
count match
{
case 0 => None
case 1 => Some("1 " + prefix + single)
case x => Some(x.toString + " " + prefix + plural)
}
}

View File

@ -5,7 +5,7 @@ package sbt.complete
import Parser._
import sbt.Types.{left, right, some}
import sbt.Collections.separate
import sbt.Util.separate
sealed trait Parser[+T]
{