diff options
author | Tom Feist <shabble@metavore.org> | 2011-01-01 18:01:56 +0000 |
---|---|---|
committer | Tom Feist <shabble@metavore.org> | 2011-01-01 18:01:56 +0000 |
commit | c6c254da652ba18021fc341fa7a6c8f1c0cc0b57 (patch) | |
tree | 2bf200e86c380715bccb0f9c1b0d76c8403b6ee3 | |
parent | ido-mode/ido_switcher: added help binding (C-h) since there were getting to b... (diff) | |
download | irssi-scripts-c6c254da652ba18021fc341fa7a6c8f1c0cc0b57.tar.gz irssi-scripts-c6c254da652ba18021fc341fa7a6c8f1c0cc0b57.zip |
feature_tests/easy_exec: further futile efforts to make a /script exec that
exposes all the Irssi exportables into the temp namespace.
-rw-r--r-- | feature-tests/easy_exec.pl | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/feature-tests/easy_exec.pl b/feature-tests/easy_exec.pl index dbcd101..669a00b 100644 --- a/feature-tests/easy_exec.pl +++ b/feature-tests/easy_exec.pl @@ -2,7 +2,7 @@ use strict; use warnings; # export everything. -use Irssi (@Irssi::EXPORT_OK); +use Irssi; #(@Irssi::EXPORT_OK); use Irssi::Irc; use Irssi::TextUI; @@ -18,12 +18,27 @@ our %IRSSI = ( license => 'Public Domain', ); -Irssi::signal_add_first 'command script exec', \&better_exec; +#Irssi::signal_add_first 'command script exec', \&better_exec; +Irssi::command_bind('script exec', \&better_exec); sub better_exec { my ($args, $serv, $witem) = @_; - eval $args; - Irssi::signal_stop(); + # todo: handle permanent arg? + my $perm = 0; + print "Args: $args"; + if ($args =~ s/^\s*-permanent\s*(.*)$/$1/) { + $perm = 1; + } + print "Args now: $args"; + +# eval $args; + my $str = "//script exec " . + ($perm ? '-permanent' : '') + . 'use Irssi (@Irssi::EXPORT_OK); ' . $args; + print "Running: $str"; + +# Irssi::command($str); + Irssi::signal_continue($str, @_[1..$#_]); } sub Dump { |