summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-01-12 19:22:29 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-01-12 19:22:29 +0100
commit87667f39ba001dd4b21b369e9fcb9a2bdda38501 (patch)
treef5c96e91ffde3ffaa94779e5f9ce33d1cdfdd852
parent4f7e4aad9e4dff740764f4c567482723e99c954a (diff)
generate both compact and complete JSON files
-rwxr-xr-xbin/db-zugbildung-to-json30
1 files changed, 21 insertions, 9 deletions
diff --git a/bin/db-zugbildung-to-json b/bin/db-zugbildung-to-json
index fc01f34..a19ecbd 100755
--- a/bin/db-zugbildung-to-json
+++ b/bin/db-zugbildung-to-json
@@ -790,12 +790,24 @@ for my $train_no ( keys %map ) {
}
# use canonical output (i.e., sort hash keys) to allow for easy diffing.
-say JSON->new->utf8->canonical->encode(
- {
- deprecated => \0,
- source => $wr_name,
- train => {%smap},
- train_variants => {%map},
- valid => $valid,
- }
-);
+if ( $ENV{WITH_VARIANTS} ) {
+ say JSON->new->utf8->canonical->encode(
+ {
+ deprecated => \0,
+ source => $wr_name,
+ train => {%smap},
+ train_variants => {%map},
+ valid => $valid,
+ }
+ );
+}
+else {
+ say JSON->new->utf8->canonical->encode(
+ {
+ deprecated => \0,
+ source => $wr_name,
+ train => {%smap},
+ valid => $valid,
+ }
+ );
+}