document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. // Shell prompt which show the current project,
  2. // git branch and build version
  3. object ShellPrompt {
  4.   object devnull extends ProcessLogger {
  5.     def info (s: => String) {}
  6.     def error (s: => String) { }
  7.     def buffer[T] (f: => T): T = f
  8.   }
  9.   def currBranch = (
  10.     ("git status -sb" lines_! devnull headOption)
  11.       getOrElse "-" stripPrefix "## "
  12.     )
  13.  
  14.   val buildShellPrompt = {
  15.     (state: State) => {
  16.       val currProject = Project.extract (state).currentProject.id
  17.       "%s:%s:%s> ".format (
  18.         currProject, currBranch, BuildSettings.buildVersion
  19.       )
  20.     }
  21.   }
  22. }
  23.  
  24.  
  25. // usage: override shellPrompt option of project settings
  26. shellPrompt  := ShellPrompt.buildShellPrompt
');