summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-05-09 06:27:40 +0200
committerDaniel Friesel <derf@finalrewind.org>2020-05-09 06:27:40 +0200
commit39a4b70c66622a74f6bbbbfaf0b3e99e60e9e511 (patch)
tree2ba479a088e591c547f1e3690bef7b519261949c /scripts
parent00eb2e36dd57dcb80945e0bd3c531263122d9d90 (diff)
add service list to README
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/update-readme20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/update-readme b/scripts/update-readme
new file mode 100755
index 0000000..27ea318
--- /dev/null
+++ b/scripts/update-readme
@@ -0,0 +1,20 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.010;
+
+use File::Slurp qw(read_file write_file);
+use Travel::Status::DE::HAFAS;
+
+my $service_list = q{};
+
+for my $s ( Travel::Status::DE::HAFAS::get_services() ) {
+ $service_list .= sprintf( "* [%s](%s)\n", $s->{name}, $s->{url} );
+}
+
+my $readme = read_file('README.md', { binmode => ':utf8' } );
+
+$readme
+ =~ s{(?<=to URLs not listed here.\n\n).*(?=\nSee the \[)}{$service_list}s;
+
+write_file('README.md', {binmode => ':utf8'}, $readme);