summaryrefslogtreecommitdiff
path: root/scripts/update-readme
blob: 27ea31817db991e030206ab7821745735d8740bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);