sbt / sbt

sbt, the interactive build tool
https://scala-sbt.org
Apache License 2.0
4.81k stars 937 forks source link

set window title to organization + artifactId + sbt command #7586

Open domdorn opened 5 months ago

domdorn commented 5 months ago

I have many microservices. When developing my features, I start most of them using docker, but some of them I start with

sbt run

or

sbt
run

The title of my terminal then just says "sbt run" or "sbt", which makes it somehow hard to differentiate different windows/services, because I start them all with the same command, e.g. take a look at the following screenshot:

grafik or even more general: grafik

Now if I have 2+ windows, these will all look very similar. If I want to figure out what application is running in that window, I have to either stop the app to see the directory/prompt or try to guess from the log messages which service is running in that window.

It would be great if there was a way that sbt would set the window title to something like "sbt run: myOrg % artifactId % version" e.g. "sbt run: com.dominikdorn.sbt % sample % 0.0.8-0-02777d76-20240620-2025"

I can set the title interactively in a sbt session using

sbt
console
print("\u001b]0;sbt run : com.dominikdorn % sample % 0.0.8-0-02777d76-20240620-2025 \u0
007")
CTRL+D

It would be great if sbt could do that out of the box on linux/unix terminals :-)

eed3si9n commented 5 months ago

Sounds like a good idea. Would you like to send a PR for this?

Run functionality I think is mostly in Run.scala - https://github.com/sbt/sbt/blob/1.10.x/run/src/main/scala/sbt/Run.scala