2korapxml: Add -o option

Change-Id: I3da2e2848c4229c2b72de468517585f77855c7f5
diff --git a/script/conllu2korapxml b/script/conllu2korapxml
index e285abf..eb381c4 100755
--- a/script/conllu2korapxml
+++ b/script/conllu2korapxml
@@ -25,6 +25,7 @@
 GetOptions(
     'force-foundry|f=s'            => \(my $foundry_name = ''),
     'log|l=s'                      => \(my $log_level = 'warn'),
+    'output|o=s'                   => \(my $outh = '-'),
 
     'help|h'                       => sub {
       pod2usage(
@@ -50,7 +51,6 @@
 
 my $docid="";
 my $zip = undef;
-my $outh = '-';
 my $parser_file;
 my $parse;
 my $morpho_file;
@@ -295,6 +295,10 @@
 
 Loglevel for I<Log::Any>. Defaults to C<warn>.
 
+=item B<--output|-o>
+
+Output file. Defaults to C<-> (stdout).
+
 =back
 
 =head1 EXAMPLES
diff --git a/t/test.t b/t/test.t
index d095392..562b594 100644
--- a/t/test.t
+++ b/t/test.t
@@ -203,6 +203,11 @@
 unlike($zipcontent, qr/.*<f name="pos">_<\/f>.*/, "conllu2korapxml ignores _ pos tags.");
 unlike($zipcontent, qr/.*<f name="upos">_<\/f>.*/, "conllu2korapxml ignores _ upos tags.");
 
+$zipfile = "$test_tempdir/goe.ud2.zip";
+script_runs([ 'script/conllu2korapxml', '-l', 'warn', '-o', $zipfile, 't/data/goe.ud.conllu.missing_textid' ], {}, "Runs conllu2korap with -o option");
+like($zipcontent, qr@GOE/AGA/00000/ud/morpho\.xml@, "conllu2korapxml UDPipe input conversion  -o option contains morpho layer with foundry name 'ud'");
+like($zipcontent, qr@GOE/AGA/00000/ud/dependency\.xml@, "conllu2korapxml UDPipe input conversion with -o option contains dependency layer with foundry name 'ud'");
+
 script_runs([ 'script/conllu2korapxml', 't/data/deu-deps.conllu' ], "Runs conllu2korap with UDPipe input");
 script_stderr_unlike "fileparse(): need a valid pathname", "Ignore sent_id and newdoc id";
 script_stderr_like "WARNING: No valid input document.*token offsets missing", "Warn on missing token offsets";