pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.28k stars 628 forks source link

Add an optional audio cue or pop up when a pants run completes #16265

Open TansyArron opened 2 years ago

TansyArron commented 2 years ago

I found this discussion on reddit interesting and I've definitely been guilty myself of starting a pants run and getting sidetracked in the couple minutes it takes to finish. Having a cue to return to my terminal and get back to work would be really helpful!

An option to have Pants make a noise or steal focus or produce a pop up or bounce the terminal icon in the dock or something to indicate that it has finished. (Probably wants some bike shedding.) Likely the desire for such a feature is pretty personal, so it might be best to be able to set it with an environment variable or in some other way such that engineers at the same org can opt in and have it run by default without having to pass a flag every time.

Setting a timer on my desk or running ./pants whatever && tput bel both of which work great if only I remember to use them. Note: tput bel makes a sad sort of noise, like the build failed. A happy pants bell would be much nicer.

cczona commented 2 years ago

Now I want a happy pants bell sound for my laptop generally. Are these bellbottom pants, I wonder?

cczona commented 2 years ago

Found the stock sound for failed build:

For success, how about any of these:

jsirois commented 2 years ago

So, generally:

^jsirois@gill ~ $ sleep 5 ; play ~/Music/getback.wav 

/home/jsirois/Music/getback.wav:

 File Size: 20.7k     Bit Rate: 179k
  Encoding: Unsigned PCM  
  Channels: 1 @ 8-bit    
Samplerate: 22254Hz      
Replaygain: off         
  Duration: 00:00:00.93  

In:100%  00:00:00.93 [00:00:00.00] Out:20.6k [      |      ] Hd:0.0 Clip:0    
Done.

That gets me Greg Maglathlin telling me to "Get back to work!" after whatever command I run completes: RIP Greg.webm

@TansyArron does something more general like that not appeal?

You could even:

$ command && play yay.mp3 || play boo.mp3
benjyw commented 2 years ago

This is a cool idea, thanks for filing! It sounds perfect for a Pants hackathon, if and when we do one.

benjyw commented 2 years ago

That said, doing this outside of Pants, or in a custom wrapper or shell alias, seems like the right solution? Rather than baking it in. As John suggests, the right alias or wrapper would work for every long-running process and doesn't need to be Pants-specific:

doit ./pants blah doit terraform blah doit docker blah

etc etc

TansyArron commented 2 years ago

Yeah, I think an alias probably solves this really well