Adjust to 1.0.x

This commit is contained in:
Eugene Yokota
2017-01-16 08:44:13 -05:00
parent b4a1f66aea
commit d91df1f189
9 changed files with 19 additions and 40 deletions
@@ -82,31 +82,6 @@ object BasicCommands {
state
}
def templateCommand = Command.make(TemplateCommand, templateBrief, templateDetailed)(templateCommandParser)
def templateCommandParser(state: State) =
{
val p = (token(Space) ~> repsep(StringBasic, token(Space))) | (token(EOF) map { case _ => Nil })
val trs = (state get templateResolvers) match {
case Some(trs) => trs.toList
case None => Nil
}
applyEffect(p)({ inputArg =>
val arguments = inputArg.toList ++
(state.remainingCommands.toList match {
case "shell" :: Nil => Nil
case xs => xs
})
trs find { tr =>
tr.isDefined(arguments.toArray)
} match {
case Some(tr) => tr.run(arguments.toArray)
case None =>
System.err.println("Template not found for: " + arguments.mkString(" "))
}
"exit" :: state.copy(remainingCommands = Nil)
})
}
def multiParser(s: State): Parser[List[String]] =
{
val nonSemi = token(charClass(_ != ';').+, hide = const(true))
@@ -3,7 +3,7 @@ package sbt
import java.io.File
import sbt.internal.util.AttributeKey
import sbt.internal.inc.classpath.ClassLoaderCache
import sbt.template.TemplateResolver
import sbt.librarymanagement.ModuleID
object BasicKeys {
val historyPath = AttributeKey[Option[File]]("history", "The location where command line history is persisted.", 40)
@@ -16,3 +16,5 @@ object BasicKeys {
private[sbt] val explicitGlobalLogLevels = AttributeKey[Boolean]("explicit-global-log-levels", "True if the global logging levels were explicitly set by the user.", 10)
private[sbt] val templateResolverInfos = AttributeKey[Seq[TemplateResolverInfo]]("templateResolverInfos", "List of template resolver infos.", 1000)
}
case class TemplateResolverInfo(module: ModuleID, implementationClass: String)
@@ -279,5 +279,3 @@ object State {
private[sbt] def getBoolean(s: State, key: AttributeKey[Boolean], default: Boolean): Boolean =
s.get(key) getOrElse default
}
case class TemplateResolverInfo(module: ModuleID, implementationClass: String)