Skip to content

Repository files navigation

StrasbourgTransport

PowerShell Gallery VersionPowerShell Gallery DownloadsCode Quality Workflow StatusPublish Module Workflow Status

A PowerShell module to query and display real-time departures for the CTS (Compagnie des Transports Strasbourgeois) network directly in your terminal.

Show-CtsDeparture demo

Features

  • ⌨️ Smart tab completion: Auto-completes stops, lines, and destinations. It ignores diacritics, so typing rep finds République instantly.
  • ♻️ Efficient caching: Network data is cached for a week, and live departure times only refresh when the API indicates new data is available.
  • 🚎 Route-aware results: Automatically includes alternative destinations traveling the same direction, so you don't miss a tram due to different terminus signs.
  • 💻 Live terminal view: The Show-CtsDeparture updates the table in place. Bold text indicates real-time data, while underlined text shows scheduled times.

Getting Started

1. Install the Module

Available on the PowerShell Gallery:

Install-PSResource -Name StrasbourgTransport -Repository PSGallery

2. Configure Your API Token

You need a valid CTS API token to fetch data.

  1. Request an account on the CTS Open Data portal.

  2. Generate a new API token.

  3. Save it securely using the module:

    Set-CtsApiToken -Token '<your-token>'

Note

The token is stored in a hidden file within the module directory. On Windows, it is encrypted for security. It loads automatically when the module is imported and is kept through module updates.


Usage

Find Stops: Find-CtsStop

Search the network for stops, lines, or destinations.

# List all available stops
Find-CtsStop

# Find stops starting with "Gallia"
Find-CtsStop Gallia

# Find stops on line A or D heading towards Kehl or Illkirch
Find-CtsStop -Line A, D -Destination Kehl, Illkirch

# Strict mode: exclude same-direction alternatives (e.g., exclude "Port du Rhin" if looking for "Kehl")
Find-CtsStop -Line A, D -Destination Kehl, Illkirch -Strict

Returns Stop objects that can be piped directly into departure commands.

Get Departures: Get-CtsDeparture

Retrieve upcoming departures for any matching stop or direction.

# Get departures for any "Gare" stop heading towards "Rotterdam"
Get-CtsDeparture Gare Rotterdam

# Pipe specific stops and limit to 5 departures per line
Find-CtsStop Esplanade | Get-CtsDeparture -MaxDepartures 5

Returns Departure objects with line info and timestamps.

Live View: Show-CtsDeparture

Print an interactive, auto-refreshing table in your terminal. Press Ctrl+C to exit.

# Live view at "Homme de Fer", refreshing every 10 seconds
Show-CtsDeparture -Stop 'Homme de Fer' -RefreshRate 10

# Pipe specific stops directly into the live view
Find-CtsStop -Line H -Destination Parlement | Show-CtsDeparture

The view updates in place. Bold times indicate real-time predictions, underlined times are scheduled.


Contributing

This project is open source and built for regular users of the CTS public transport network. If you find a bug, have a feature idea, or want to improve the existing logic, feel free to open an issue or submit a pull request.

Tip

The CTS API returns a lot more information than tram and bus departures: bike sharing slots, park & ride availability, disruption announcements...

Check all the API types in Classes/CtsApi.ps1, maybe it will give you some ideas!

About

Display Strasbourg public transport departures in PowerShell

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages