config/sbt/settings/prompt.sbt

11 lines
516 B
Scala

import scala.sys.process._
shellPrompt := { state =>
val extracted = Project.extract(state)
val projectId = (extracted.currentRef / name).get(extracted.structure.data).getOrElse(extracted.currentProject.id)
val gitBranch = Seq("git", "branch", "--show-current").!!.trim
val projectIdSegment = Def.withColor(projectId, Option(scala.Console.CYAN), useColor = true)
val gitBranchSegment = Def.withColor(gitBranch, Option(scala.Console.YELLOW), useColor = true)
s"[$projectIdSegment $gitBranchSegment]> "
}