score:0

Accepted answer

Actully, no need for sbt. To have it tweaked, scala code should be changed.

score:0

For the sbt "Customized command prompt" part, you have a good example with "sbt: Customize the Shell prompt in sbt" from Patrick Bailey (patmandenver).

create the ~/.sbt/0.13/global.sbt file:

vi ~/.sbt/0.13/global.sbt

And place the following in it.

shellPrompt := { state =>
  def textColor(color: Int)      = { s"\033[38;5;${color}m" }
  def backgroundColor(color:Int) = { s"\033[48;5;${color}m" }
  def reset                      = { s"\033[0m" }

  def formatText(str: String)(txtColor: Int, backColor: Int) = {
    s"${textColor(txtColor)}${backgroundColor(backColor)}${str}${reset}"
  }
  val red    = 1
  val green  = 2
  val yellow = 11
  val white  = 15
  val black  = 16
  val orange = 166

  formatText(s"[${name.value}]")(white, orange) +
   "\n " +
   formatText("\u276f")(green, black) +
   formatText("\u276f")(yellow, black) +
   formatText("\u276f ")(red, black)
}

Run reload in sbt and….

https://3.bp.blogspot.com/-tPdrR9q-gls/Vuf61H7koFI/AAAAAAAAK7s/aqIkdp49DRk_im6F4RZgPj6qElP-ePWUw/s640/customize_shell_prompt_027.png

That can be amended/enhanced/completed to add other information you would need in your case.


Related Query

More Query from same tag