|
| 1 | +# irail-cli |
| 2 | + |
| 3 | +CLI for Belgian railway (NMBS/SNCB) real-time schedules via [iRail API](https://api.irail.be/). |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +### Homebrew (macOS/Linux) |
| 8 | + |
| 9 | +```bash |
| 10 | +brew install dedene/tap/irail |
| 11 | +``` |
| 12 | + |
| 13 | +### Go Install |
| 14 | + |
| 15 | +```bash |
| 16 | +go install github.com/dedene/irail-cli/cmd/irail@latest |
| 17 | +``` |
| 18 | + |
| 19 | +### Binary |
| 20 | + |
| 21 | +Download from [Releases](https://github.com/dedene/irail-cli/releases). |
| 22 | + |
| 23 | +## Usage |
| 24 | + |
| 25 | +### Liveboard |
| 26 | + |
| 27 | +Show departures from a station: |
| 28 | + |
| 29 | +```bash |
| 30 | +irail liveboard Brugge |
| 31 | +irail liveboard "Brussel-Centraal" |
| 32 | +irail liveboard Brugge --arrivals |
| 33 | +irail liveboard Brugge --time 09:00 --date 2025-02-15 |
| 34 | +``` |
| 35 | + |
| 36 | +### Connections |
| 37 | + |
| 38 | +Find routes between stations: |
| 39 | + |
| 40 | +```bash |
| 41 | +irail connections Brugge Leuven |
| 42 | +irail connections Brugge Leuven --time 09:00 |
| 43 | +irail connections Brugge Leuven --arrive-by # time is arrival time |
| 44 | +irail connections Brugge Leuven --results 10 |
| 45 | +``` |
| 46 | + |
| 47 | +### Stations |
| 48 | + |
| 49 | +List or search stations: |
| 50 | + |
| 51 | +```bash |
| 52 | +irail stations |
| 53 | +irail stations --search bruss |
| 54 | +``` |
| 55 | + |
| 56 | +### Vehicle |
| 57 | + |
| 58 | +Show train information: |
| 59 | + |
| 60 | +```bash |
| 61 | +irail vehicle IC1832 |
| 62 | +irail vehicle IC1832 --stops # show all stops |
| 63 | +``` |
| 64 | + |
| 65 | +### Composition |
| 66 | + |
| 67 | +Show train composition (seats, amenities): |
| 68 | + |
| 69 | +```bash |
| 70 | +irail composition S51507 |
| 71 | +``` |
| 72 | + |
| 73 | +### Disturbances |
| 74 | + |
| 75 | +Show service disruptions: |
| 76 | + |
| 77 | +```bash |
| 78 | +irail disturbances |
| 79 | +irail disturbances --type planned # only planned works |
| 80 | +irail disturbances --type disturbance # only disruptions |
| 81 | +``` |
| 82 | + |
| 83 | +## Options |
| 84 | + |
| 85 | +| Flag | Description | |
| 86 | +|------|-------------| |
| 87 | +| `--json` | Output JSON | |
| 88 | +| `--lang` | Language: nl, fr, en, de | |
| 89 | +| `--no-color` | Disable colors | |
| 90 | + |
| 91 | +### Environment Variables |
| 92 | + |
| 93 | +- `IRAIL_LANG` - Default language |
| 94 | +- `IRAIL_JSON` - Default to JSON output |
| 95 | +- `NO_COLOR` - Disable colors |
| 96 | + |
| 97 | +## Features |
| 98 | + |
| 99 | +- Real-time departures and arrivals |
| 100 | +- Connection planning with transfers |
| 101 | +- Delay highlighting (red for delays) |
| 102 | +- Platform change warnings (yellow ⚠️) |
| 103 | +- Occupancy indicators |
| 104 | +- Clickable train links (in supported terminals) |
| 105 | +- Shell completions (bash, zsh, fish) |
| 106 | + |
| 107 | +## Shell Completions |
| 108 | + |
| 109 | +```bash |
| 110 | +# Bash |
| 111 | +irail completion bash > /etc/bash_completion.d/irail |
| 112 | + |
| 113 | +# Zsh |
| 114 | +irail completion zsh > "${fpath[1]}/_irail" |
| 115 | + |
| 116 | +# Fish |
| 117 | +irail completion fish > ~/.config/fish/completions/irail.fish |
| 118 | +``` |
| 119 | + |
| 120 | +## License |
| 121 | + |
| 122 | +MIT |
0 commit comments