Skip to content

calculates your train ride to a specific location

Notifications You must be signed in to change notification settings

devskar/check-bvg

Repository files navigation

check bvg

Explanation

Simple command line tool that give u an x amount of departures from a train station to a another one, to arrive at a certain time.

It works completely config based, but all parameters should also be able to be passed via command line. Command Line arguments will always override config arguments.

It is basically a simple wrapper of the hafas-client, that introduces a config base cli tool, and has the ability to start a rest server that accepts configs as payload.

Config

example/default

{
	"config": "check-bvg.config.json",
	"start": "S+U Alexanderplatz",
	"end": "S Hackescher Markt",
	"arrivalTime": "8:00",
	"resultAmount": 3,
	"server": false,
	"port": 3000
}

CLI

check-bvg -c ./check-bvg.config.json --resultAmount 5

Usage: check-bvg [options]

Options:

  • -V, --version output the version number
  • -C, --config <path> Path to config
  • -S, --start <start-station> Name of the station where the journey starts
  • -E, --end <end-station> Name of the station where the journey ends
  • -A, --arrivalTime <time> Time where you want to arrive at the end station
  • -R, --resultAmount <amount> Amount of results the script should return
  • --server Sets up a server that responds to rest requests
  • -P, --port <port> Defines the port of the server
  • -h, --help display help for command

REST

journey endpoint

POST /api/v1/journey

Payload is basically a config object.

Use Case

I am using this script personally to get the 3 latest trains I have to catch every morning. The results will later be used by another service.

Features

[ ] Parings Dates as AM/PM

About

calculates your train ride to a specific location

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published