An open API service indexing awesome lists of open source software.

https://github.com/kevcui/bahn-cli

:train: DB train timetable in CLI
https://github.com/kevcui/bahn-cli

bash bash-script cli deutsche-bahn

Last synced: about 2 months ago
JSON representation

:train: DB train timetable in CLI

Awesome Lists containing this project

README

          

# bahn-cli ![CI](https://github.com/KevCui/bahn-cli/workflows/CI/badge.svg)

CLI tool for searching train timetable from Deutsche Bahn, aka [DB](https://www.bahn.de/p/view/index.shtml).

## Dependency

- [cURL](https://curl.haxx.se/)
- [jq](https://stedolan.github.io/jq/)
- python3: [hashlib](https://docs.python.org/3/library/hashlib.html)

## How to use

```
Usage:
./bahn.sh -d -a [-t ]

Options:
-d Departure station name
-a Arrival station name
-t Departure date:time, like: "20190630:1300"
If it's not specified, default current date & time
-h | --help Display this help message

Examples:
- Search next trains from `hamburg` to `berlin`:
~$ ./bahn.sh -d 'hamburg hbf' -a 'berlin hbf'

- Search trains from `hamburg` to `berlin` at `13:30` on `20190730`:
~$ ./bahn.sh -d 'hamburg hbf' -a 'berlin hbf' -t '20190730:1330'
```

## Run tests

```
~$ bats test/bahn.bats
```

## Acknowledgment

Inspired by [pajowu/db-python](https://github.com/pajowu/db-python/blob/master/bahn.py)