From 538b2c13f460213b61baa5190b88aa5eff7765e8 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Tue, 26 Apr 2016 11:41:22 -0700 Subject: Trim whitespace from hilighted text and improve script usage examples --- scripts/hilightcmd.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/hilightcmd.pl b/scripts/hilightcmd.pl index c2c8295..42585ef 100644 --- a/scripts/hilightcmd.pl +++ b/scripts/hilightcmd.pl @@ -3,8 +3,11 @@ # Originally based on hilightwin.pl work and djcraven5's idea for making remote # computer beep through ssh. # -# Example of use, assuming you got a ssh and beep on your remote: -# /set hilightcmd_systemcmd ssh user@host beep & +# Example of use, assuming you have ssh and beep on your remote: +# /set hilightcmd_systemcmd ssh user@host beep & +# +# The hilighted text may be passed as a quoted string: +# /set hilightcmd_systemcmd printf "%s\n" %(message)s >> ~/hilights # use strict; @@ -36,7 +39,7 @@ Irssi::signal_add('print text' => sub { && (Irssi::active_win()->{refnum} != $dest->{window}->{refnum} || Irssi::settings_get_bool('hilightcmd_currentwin'))) { - $stripped =~ s/"/\\"/g; + $stripped =~ s/^\s+|\s+$//g; system(named_sprintf( Irssi::settings_get_str('hilightcmd_systemcmd'), message => shell_quote_best_effort $stripped -- cgit v1.2.3