import sbt._ import Keys._ // This lifted from https://github.com/mingchuno/aws-wrap/blob/master/project/CustomShellPrompt.scala object CustomShellPrompt { val Branch = """refs/heads/(.*)\s""".r def gitBranchOrSha = (Process("git symbolic-ref HEAD") #|| Process("git rev-parse --short HEAD")).!! match { case Branch(name) => name case sha => sha.stripLineEnd } val customPrompt = { state: State => val extracted = Project.extract(state) import extracted._ (name in currentRef get structure.data) map { name => "[" + scala.Console.CYAN + name + scala.Console.RESET + "] " + scala.Console.BLUE + "git:(" + scala.Console.RED + gitBranchOrSha + scala.Console.BLUE + ")" + scala.Console.RESET + " $ " } getOrElse ("> ") } }