Support LOAD() directives in scripts
Change-Id: Ib22192a942daa47c40d4fe5712a63de9c71b68af
diff --git a/script/cosmasvc2koralquery b/script/cosmasvc2koralquery
index e674964..e73166e 100755
--- a/script/cosmasvc2koralquery
+++ b/script/cosmasvc2koralquery
@@ -33,9 +33,9 @@
)
or die("Error in command line arguments\n");
-if (!$cmd || ($cmd ne 'def' && $cmd ne 'list')) {
+if (!$cmd || ($cmd ne 'def' && $cmd ne 'list' && $cmd ne 'script')) {
print <<'HELP';
-Convert a list of C2 VC definitions or a single definition into
+Convert a list of C2 VC definitions, a single definition or a script file into
KoralQuery VCs.
$ perl cosmasvc2koralquery def my_vc.txt | gzip -vc > my_vc.jsonld.gz
@@ -54,6 +54,12 @@
--output: The output directory
--copy-src: The directory for def files to copy
+Command: script
+
+ Convert a script file with LOAD() instructions to KoralQuery VCs.
+
+ --output: The output directory
+
HELP
exit 1;
};
@@ -69,6 +75,16 @@
exit(0);
};
+# Process a list
+if ($cmd eq 'script') {
+ KorAP::ScriptLoad->new(
+ file => ($input || $ARGV[0]),
+ output => ($output || '.')
+ )->parse;
+ exit(0);
+};
+
+
# Parse a single def
my $def_parser;
if ($ARGV[0] eq '-') {