]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
[oops] Also call /names on ll
authorWieland Hoffmann <redacted>
Tue, 3 Jul 2018 16:20:51 +0000 (18:20 +0200)
committerWieland Hoffmann <redacted>
Tue, 3 Jul 2018 16:22:48 +0000 (18:22 +0200)
ll is aliased to `ls -l` on a lot of distributions by default and has made its
way into (at least my) muscle memory right next to regular ls.

scripts/oops.pl

index d72f59f55b8b16f55503ef1db2a4b6e6fcfa3ff1..8b3c33aacec24b754d614eccfb729e943c7d357d 100644 (file)
@@ -8,22 +8,23 @@ $VERSION = '20071209';
     contact     => '',\r
     name        => 'oops',\r
     description =>\r
-'turns \'ls\' in the beginning of a sent line into the names or whois commands',\r
+'turns \'ll\' and \'ls\' in the beginning of a sent line into the names or whois commands',\r
     license => 'Public Domain',\r
 );\r
 \r
 sub send_text {\r
+    my $pattern = qr/(^ll |^ll$|^ls |^ls$)/;\r
 \r
     #"send text", char *line, SERVER_REC, WI_ITEM_REC\r
     my ( $data, $server, $witem ) = @_;\r
     if ( $witem\r
         && ( $witem->{type} eq "CHANNEL" )\r
-        && ( $data =~ /(^ls |^ls$)/ ) )\r
+        && ( $data =~ $pattern ) )\r
     {\r
         $witem->command("names $witem->{name}");\r
         Irssi::signal_stop();\r
     }\r
-    if ( $witem && ( $witem->{type} eq "QUERY" ) && ( $data =~ /(^ls |^ls$)/ ) )\r
+    if ( $witem && ( $witem->{type} eq "QUERY" ) && ( $data =~ $pattern ) )\r
     {\r
         $witem->command("whois $witem->{name}");\r
         Irssi::signal_stop();\r
git clone https://git.99rst.org/PROJECT