A PowerShell module to query and display real-time departures for the CTS (Compagnie des Transports Strasbourgeois) network directly in your terminal.
- ⌨️ Smart tab completion: Auto-completes stops, lines, and destinations. It ignores diacritics, so typing
repfindsRépubliqueinstantly. - ♻️ 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-CtsDepartureupdates the table in place. Bold text indicates real-time data, while underlined text shows scheduled times.
Available on the PowerShell Gallery:
Install-PSResource -Name StrasbourgTransport -Repository PSGalleryYou need a valid CTS API token to fetch data.
-
Request an account on the CTS Open Data portal.
-
Generate a new API token.
-
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.
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 -StrictReturns Stop objects that can be piped directly into departure commands.
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 5Returns Departure objects with line info and timestamps.
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-CtsDepartureThe view updates in place. Bold times indicate real-time predictions, underlined times are scheduled.
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!
