diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-07-04 18:22:18 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-07-04 18:22:18 -0400 |
commit | 9a09a819c4a05a1ebe7dcfa0cfa6d1f63df9b7be (patch) | |
tree | 846700ceeb33b1d041811bef3408123cbb0842c2 /lib | |
parent | 6ffc228ece35cfeafb33bfb5dbf2da4df659dcef (diff) | |
download | reply-9a09a819c4a05a1ebe7dcfa0cfa6d1f63df9b7be.tar.gz reply-9a09a819c4a05a1ebe7dcfa0cfa6d1f63df9b7be.zip |
also allow executing files (#36)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Reply/App.pm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Reply/App.pm b/lib/Reply/App.pm index 5a1004d..7d93238 100644 --- a/lib/Reply/App.pm +++ b/lib/Reply/App.pm @@ -42,7 +42,7 @@ sub run { my $cfgfile = '.replyrc'; my $exitcode; - my (@modules, @script_lines); + my (@modules, @script_lines, @files); my $parsed = GetOptionsFromArray( \@argv, 'cfg:s' => \$cfgfile, @@ -55,6 +55,13 @@ sub run { 'help' => sub { $exitcode = 0; usage() }, ); + @files = @argv; + for my $file (@files) { + if (!stat $file) { + die "Can't read $file: $!"; + } + } + if (!$parsed) { usage(1); $exitcode = 1; @@ -89,6 +96,11 @@ sub run { print $reply->_wrapped_plugin('prompt'), $line, "\n"; $reply->step($line); } + for my $file (@argv) { + my $line = 'do "' . quotemeta($file) . '"'; + print $reply->_wrapped_plugin('prompt'), $line, "\n"; + $reply->step($line); + } $reply->run; return 0; |