Skip to content

Instantly share code, notes, and snippets.

@dcsobral
Created January 24, 2012 17:15
Show Gist options
  • Save dcsobral/1671235 to your computer and use it in GitHub Desktop.
Save dcsobral/1671235 to your computer and use it in GitHub Desktop.
Project:(git)Branch> SBT Prompt
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