eradman/entr

Feature request: ring terminal bell after command finishes

pxeger opened this issue · 5 comments

It would be nice to have an option that rings the terminal bell, by outputting the control character 0x07 (\a), when the command has finished. When using entr for automatic rebuilds/redeploys or similar, this would help me know when the effect of my changes should be visible.

Of course, this can be done already with entr -s 'command; printf \\a', but having to reformat the command for use with the -s option is a bit inconvenient. This would be a very similar convenience to the existing -c option.

This would be easy to implement, but I personally don't use the bell so it doesn't feel general enough.

We'll leave this ticket up for others to comment on

Still considering this...one objection I will have is that adding a flag for the terminal bell is that a simple flag won't allow the behavior the be customized. Writing a snippet of shell is more typing, but allows a wide rage of behaviors

entr -s 'command ;  printf \\a'  # bell after command returns
entr -s 'command || printf \\a'  # bell if command fails
entr -s 'command && printf \\a'  # bell if command succeeds

I personally think that entr should not be extended with new flag for bell. Those 3 shell snippets from @eradman are supporting my believe.

@pxeger, you can always wrap entr to a script which will do the job for you. Or create some kind of bel script which will wrap the command with the final bel. Something like this might work for you:

#! /bin/sh
"${@}"
printf '\a'

Then, the entr will be called like this:

entr bel command

It is convenient, short, looks and behaves like a flag but without leading hyphen :)

I agree with your arguments and I now think this is not a good idea.

Thanks for the followup @pxeger, @arkamar!

Maybe Unix-like distributions will introduce bell(1) command someday that is
a) customizable with a .dot-file
b) guaranteed not to block