Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/main/scala/com/typesafe/sbt/SbtGit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.typesafe.sbt
import sbt._
import Keys._
import git.{ConsoleGitRunner, DefaultReadableGit, GitRunner, JGitRunner, ReadableGit}
import scala.Console
import sys.process.Process

/** This plugin has all the basic 'git' functionality for other plugins. */
Expand Down Expand Up @@ -95,14 +96,16 @@ object SbtGit {

val prompt: State => String = { state =>
val extracted = Project.extract(state)
val reader = extracted get GitKeys.gitReader
val dir = extracted get baseDirectory
val name = extracted get Keys.name
val dir = extracted.get(baseDirectory)
val name = extracted.get(Keys.name)
val end = s"${Console.BLUE}> ${Console.RESET}"
if (isGitRepo(dir)) {
val branch = reader.withGit(_.branch)
name + "(" + branch + ")> "
val reader = extracted.get(GitKeys.gitReader)
val branchName = reader.withGit(_.branch)
val branchColored = s"${Console.GREEN}[$branchName]${Console.RESET}"
name + branchColored + end
} else {
name + "> "
name + end
}
}
}
Expand Down