Hello Anthony,
First few lines from my ~/.sbt/global.sbt
1
2 shellPrompt := { state ⇒
3 (scala.Console.CYAN + "sbt @ %s > " + scala.Console.RESET) format {
4 Project.extract(state).getOpt(
sbt.Keys.name) getOrElse {
5 Project.extract(state).currentProject.id
6 }
7 }
8 }
9
Have a look at the scala.Console$ documentation for other supported
colors:
http://www.scala-lang.org/archives/downloads/distrib/files/nightly/docs/library/index.html#scala.Console$
The other part of my shell prompt is the name or else the id of the
current project.
On Sat, Dec 15, 2012 at 04:19:26PM -0800, Anthony wrote:
> When creating a custom prompt, such as the docs example below, is it possible
> to color the prompt similar to escape codes in .bashrc?
>
> I'm using sbt 0.12.1 and Ubuntu 12.04.
>
> I don't have a lot of linux experience so I appreciate a specific reference or
> example.
>
> object ShellPrompt {
> object devnull extends ProcessLogger {
> def info (s: => String) {}
> def error (s: => String) { }
> def buffer[T] (f: => T): T = f
> }
> def currBranch = (
> ("git status -sb" lines_! devnull headOption)
> getOrElse "-" stripPrefix "## "
> )
>
> val buildShellPrompt = {
> (state: State) => {
> val currProject = Project.extract (state).currentProject.id
> "%s:%s:%s> ".format (
> currProject, currBranch, VersionSettings.buildVersion
> )
> }
> }
> }
>
> --Anthony
>
> --
> You received this message because you are subscribed to the Google Groups
> "simple-build-tool" group.
> To view this discussion on the web visit
https://groups.google.com/d/msg/
> simple-build-tool/-/lMa2aVgCa3gJ.
> To post to this group, send email to
simple-b...@googlegroups.com.
> To unsubscribe from this group, send email to
>
simple-build-t...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/
> simple-build-tool?hl=en.
--
Beste Grüße / Best Regards
Christian Krause aka wookietreiber
-----------------------------------------------------------------------
EGAL WIE DICHT DU BIST, GOETHE WAR DICHTER.