]> mj.ucw.cz Git - temple.git/commitdiff
temple -e master
authorMartin Mares <mj@ucw.cz>
Tue, 9 Nov 2021 10:30:15 +0000 (11:30 +0100)
committerMartin Mares <mj@ucw.cz>
Tue, 9 Nov 2021 10:30:15 +0000 (11:30 +0100)
temple

diff --git a/temple b/temple
index f74543329a26d46a5b81e5e0cbc8f4d536a3f942..b1301a6055e71718322e120bb6b5ee2fe80eb14e 100755 (executable)
--- a/temple
+++ b/temple
@@ -10,14 +10,18 @@ use Getopt::Long;
 use UCW::Temple;
 
 my $out;
+my @execs = ();
 
-GetOptions('out|o=s' => \$out) or die "Usage: temple [-o <out>] <in> ...";
+GetOptions('out|o=s' => \$out, 'exec|e=s' => \@execs) or die "Usage: temple [-o <out>] [-e <string>] <in> ...";
 if (defined $out) {
        close STDOUT;
-       open STDOUT, ">$out" or die "Cannot open $out: $!";
+       open STDOUT, '>:utf8', $out or die "Cannot open $out: $!";
 }
 if (!@ARGV) { push @ARGV, "-"; }
 UCW::Temple::start();
+foreach (@execs) {
+       UCW::Temple::parse_string($_, "-e");
+}
 foreach (@ARGV) {
        UCW::Temple::parse_file($_);
 }