New plugin: beep on error
If you computer beeps, that is. Most revbank setups run on raspberry pi's, which don't beep...
This commit is contained in:
parent
354738fc02
commit
da043ba2df
3 changed files with 19 additions and 1 deletions
17
plugins/beep
Normal file
17
plugins/beep
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#!perl
|
||||||
|
|
||||||
|
sub command { NEXT }
|
||||||
|
|
||||||
|
*hook_plugin_fail = *hook_retry = *hook_reject = *hook_invalid_input = sub {
|
||||||
|
call_hooks('beep');
|
||||||
|
undef;
|
||||||
|
};
|
||||||
|
|
||||||
|
sub hook_abort {
|
||||||
|
my ($self, $cart, $reason) = @_;
|
||||||
|
return if not $reason or not @$reason;
|
||||||
|
return if "@$reason" eq '^C';
|
||||||
|
|
||||||
|
call_hooks('beep');
|
||||||
|
undef;
|
||||||
|
}
|
2
revbank
2
revbank
|
@ -139,7 +139,7 @@ OUTER: for (;;) {
|
||||||
print @_, " " if @_;
|
print @_, " " if @_;
|
||||||
@words = ();
|
@words = ();
|
||||||
@retry = ();
|
@retry = ();
|
||||||
call_hooks "abort", $cart;
|
call_hooks "abort", $cart, \@_;
|
||||||
$cart->empty;
|
$cart->empty;
|
||||||
{ no warnings; redo OUTER; }
|
{ no warnings; redo OUTER; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# First, plugins with no commands, or very specific commands
|
# First, plugins with no commands, or very specific commands
|
||||||
|
|
||||||
log # first, so that the registrations of other plugins are logged
|
log # first, so that the registrations of other plugins are logged
|
||||||
|
beep
|
||||||
sigint
|
sigint
|
||||||
restart
|
restart
|
||||||
help
|
help
|
||||||
|
|
Loading…
Add table
Reference in a new issue