Created
January 24, 2012 17:15
-
-
Save dcsobral/1671235 to your computer and use it in GitHub Desktop.
Project:(git)Branch> SBT Prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shellPrompt <<= name(name => { state: State => | |
object devnull extends ProcessLogger { | |
def info(s: => String) {} | |
def error(s: => String) { } | |
def buffer[T](f: => T): T = f | |
} | |
val current = """\*\s+(\w+)""".r | |
def gitBranches = ("git branch --no-color" lines_! devnull mkString) | |
"%s:%s>" format ( | |
name, | |
current findFirstMatchIn gitBranches map (_.group(1)) getOrElse "-" | |
) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment