metro-cli

module
v0.7.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2026 License: MIT

README


🚇 metro-cli

C'est dans combien le prochain ?

Real-time Ile-de-France departures and disruptions in your terminal.


CI Release License Go


$ metro departures chatelet

  Châtelet (Paris)

  Line   Direction                  Next departures
  ----   ---------                  ---------------
  M1     La Défense                 2 min, 5 min, 9 min
  M1     Château de Vincennes       now, 4 min, 8 min
  M4     Porte de Clignancourt      3 min, 7 min
  M14    Olympiades                 2 min, 5 min

$ metro departures chatelet --mode rer

  Châtelet les Halles (Paris)

  Line    Direction                  Next departures
  ----    ---------                  ---------------
  RER A   Marne-la-Vallée Chessy     2 min, 14 min
  RER B   Aéroport CDG 2 TGV        4 min, 19 min
  RER D   Creil                      7 min

$ metro disruptions --mode rer

  Line    Status       Info
  ----    ------       ----
  RER A   OK
  RER B   OK
  RER C   Modified     Issy : gare non desservie
  RER D   Delays       Plan de transport adapté
  RER E   OK


Install

Quick install (Linux / macOS):

curl -sSfL https://raw.githubusercontent.com/cyrilghali/metro-cli/master/install.sh | sh

This downloads the latest release binary and installs it to /usr/local/bin (may prompt for sudo). Run it again at any time to update to the latest version.

From source:

go install github.com/cyrilghali/metro-cli/cmd/metro@latest

Or clone and build:

git clone https://github.com/cyrilghali/metro-cli.git
cd metro-cli
go build -o metro ./cmd/metro

Setup

Get a free API token at prim.iledefrance-mobilites.fr, then:

metro config --token YOUR_TOKEN

Set a default station so you can just run metro departures:

metro config --default-station chatelet
Other token methods
# Environment variable
export PRIM_TOKEN=your_token

# .env file in current directory
echo 'token=your_token' > .env

Token lookup order: PRIM_TOKEN env → ~/.metro.toml.env


Usage

metro departures — next trains
metro departures chatelet              # search by station name (all modes)
metro d chatelet                       # short alias
metro dep "gare de lyon"              # quotes for multi-word names
metro d "73 rue rivoli"                # search by address (finds nearby stops)
metro d home                           # use a saved place (see "metro places")
metro d --here                         # auto-detect location via browser
metro d                                # uses your default station
metro d chatelet -m metro              # metro only
metro d chatelet -m rer                # RER only

When multiple stations match, an interactive picker lets you choose:

Multiple results found:
  1. Châtelet (Stop [M1, M4, M7, M11, M14]) - Paris
  2. Châtelet les Halles (Stop [RER A, RER B, RER D]) - Paris
  3. Château d'Eau (Stop [M4]) - Paris

Pick a number:

metro disruptions — line status
metro disruptions                      # all lines (default)
metro dis                              # short alias
metro status                           # another alias
metro dis -m metro                     # metro lines only
metro dis -m rer                       # RER lines only
metro dis --line A                     # filter by line

Status is color-coded in your terminal:

Color Meaning
🟢 Green Normal service
🟡 Yellow Delays / reduced / modified service
🔴 Red Service interrupted

--mode — transport modes

Both departures and disruptions accept a --mode / -m flag:

Mode What Lines
all Everything (default) All modes
metro Metro M1-M14, M3B, M7B
rer RER A, B, C, D, E
train Transilien H, J, K, L, N, P, R, U
tram Tramway T1-T13
bus Bus All IDF bus lines

metro places — saved places

Save stations you use often and skip the search + picker entirely:

metro places                           # list saved places
metro places save home chatelet        # save "chatelet" as "home"
metro places save work "la defense"    # save "la defense" as "work"
metro places remove home               # remove a saved place

Then just use the alias:

metro d home                           # instant — no search, no picker
metro d work -m rer                    # works with all flags

metro config — settings
metro config                           # view current config
metro config --token YOUR_TOKEN        # save API token
metro config --default-station nation  # save default station

Config is stored in ~/.metro.toml.


The --here flag

The --here flag finds stops near your current location:

  1. Starts a temporary local HTTP server
  2. Opens your browser
  3. Browser asks for geolocation permission
  4. Coordinates are sent back to the CLI
  5. Nearby stops are found within 500m

Works on macOS, Linux, and Windows.


How it works

Feature How
Saved places Aliases stored in ~/.metro.toml, bypass API search
Station search PRIM places API with mode filtering + interactive picker
Address search Navitia geocoding → nearby stops within 500m
Geolocation Temporary localhost server + browser navigator.geolocation
Departures Navitia v2 real-time API, filtered by transport mode
Disruptions Navitia lines endpoint with embedded disruption data

All data comes from the PRIM Ile-de-France Mobilites API gateway.


License

MIT

Directories

Path Synopsis
cmd
metro command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL