← 返回
未分类 Key 中文

Rail CLI

UK National Rail CLI — live departures, arrivals, station search, destination filtering, batch station search from stdin, and lightweight field selection for...
英国国家铁路CLI:实时出发、到达、车站搜索、目的地过滤、批量车站搜索(从stdin)以及轻量级字段选择 for...
shan8851
未分类 clawhub v0.2.2 2 版本 100000 Key: 需要
★ 0
Stars
📥 474
下载
💾 0
安装
2
版本
#latest

概述

rail-cli

Use rail for UK National Rail data: live departures, arrivals, station search, destination filtering, and agent-friendly batch search.

Setup

  • npm install -g @shan8851/rail-cli
  • Get a free Darwin access token: https://realtime.nationalrail.co.uk/OpenLDBWSRegistration/Registration
  • export DARWIN_ACCESS_TOKEN=your_token or add to .env
  • Station search works without a token. Departures and arrivals require one.

Departures

  • From a station: rail departures KGX
  • By station name: rail departures "kings cross"
  • Filter to destination: rail departures "edinburgh" --to "york"
  • Include calling points: rail departures KGX --expand
  • Limit results: rail departures KGX --limit 5

Arrivals

  • At a station: rail arrivals "leeds"
  • By CRS code: rail arrivals LDS
  • Filter from origin: rail arrivals "leeds" --from "london"
  • Include calling points: rail arrivals LDS --expand
  • Limit results: rail arrivals LDS --limit 5

Station Search

  • Search by name: rail search "waterloo"
  • Return only CRS codes: rail search "waterloo" --select crs
  • Return only names: rail search "waterloo" --select name
  • Return explicit name + CRS projection: rail search "waterloo" --select name,crs
  • Batch search from stdin: printf "waterloo\nvictoria\n" | rail search --stdin
  • Batch search as JSON: printf "waterloo\nvictoria\n" | rail search --stdin --json

Output

  • All commands default to text in TTY, JSON when piped
  • Force JSON: rail departures KGX --json
  • Force text: rail departures KGX --text
  • Disable colour: rail --no-color departures KGX
  • Success envelope: { ok, schemaVersion, command, requestedAt, data }
  • Error envelope: { ok, schemaVersion, command, requestedAt, error }

Agent Notes

  • rail search --stdin is pipeline-only and expects newline-delimited queries on stdin
  • rail search --select is intentionally narrow: name, crs, or name,crs
  • rail search --stdin and a positional query cannot be used together
  • Search output stays stable unless projection flags are explicitly used
  • Errors are structured and suitable for agent retry/self-correction

Configuration

  • DARWIN_ACCESS_TOKEN — required for departures/arrivals (free registration)
  • RAIL_API_URL — optional, override Huxley2 instance URL (default: public instance)

Notes

  • Accepts station names ("kings cross", "leeds") and CRS codes (KGX, LDS, EDB)
  • CRS codes are 3-letter station identifiers
  • Covers every National Rail station in Great Britain
  • Data powered by National Rail Darwin via Huxley2
  • Exit codes: 0 success, 2 bad input or ambiguity, 3 upstream failure, 4 internal error
  • When a station name is ambiguous, the error includes candidate suggestions

版本历史

共 2 个版本

  • v0.2.2 当前
    2026-05-03 05:46 安全 安全
  • v0.2.1
    2026-03-30 23:11

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Fuel CLI

shan8851
英国燃料价格命令行工具 — 通过邮编或坐标查找附近加油站,获取站点详情,按价格/距离/新鲜度排名,支持代理友好的 JSON 包装
★ 0 📥 408

tfl-cli

shan8851
伦敦交通命令行工具 — 地铁状态查询、行程规划、实时到站、运营中断、自行车停放点,以及通过 `--output <path>` 进行代理友好的路线投影输出。
★ 1 📥 500

companies-house-cli

shan8851
UK Companies House CLI — 搜索公司、公司概况、董事、申报、PSC、抵押、破产,提供代理友好的 JSON 输出,兼容 rail-cli 与 tf...
★ 0 📥 450