Unverified Commit 65a08b86 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

dbris-m: show trip number changes along the route, if any

parent 13396e44
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -391,7 +391,7 @@ elsif ( $opt{journey} and not( $raw_json_output or $json_output ) ) {

	printf( "%s %s am %s\n",
		$trip->type,
		$trip->train_no // $trip->number,
		$trip->line_no // join( q{ / }, $trip->trip_numbers ),
		$trip->day->strftime('%d.%m.%Y') );

	if ( $trip->operators ) {
@@ -399,6 +399,11 @@ elsif ( $opt{journey} and not( $raw_json_output or $json_output ) ) {
	}
	say q{};

	my $prev_trip_no;
	if ( scalar $trip->trip_numbers > 1 ) {
		$prev_trip_no = $trip->train_no;
	}

	for my $stop ( $trip->route ) {
		if ( $stop == $mark_stop ) {
			print($output_bold);
@@ -426,11 +431,20 @@ elsif ( $opt{journey} and not( $raw_json_output or $json_output ) ) {
		if ($max_occupancy) {
			printf( "  %${max_occupancy}s", format_occupancy($stop) );
		}
		printf( "  %-${max_name}s  %${max_platform}s\n",
		printf( "  %-${max_name}s  %${max_platform}s",
			$stop->name, $stop->platform // q{} );
		if ( $stop == $mark_stop ) {
			print($output_reset);
		}

		if (    defined $prev_trip_no
			and defined $stop->trip_no
			and $stop->trip_no ne $prev_trip_no )
		{
			printf( '  (%s %s)', $trip->type, $stop->trip_no );
			$prev_trip_no = $stop->trip_no;
		}
		print("\n");
	}
	if ( $trip->attributes ) {
		say q{};