Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
/ metrohero-rs Public archive

A rust client for the MetroHero API

Notifications You must be signed in to change notification settings

epikulski/metrohero-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The MetroHero API that this CLI relies on is being discontinued, and this CLI will no longer function.

metrohero-rs

An unofficial rust client and CLI for the MetroHero API.

Using metrohero-rs requires an API key. Information on how to acquire one is published at: https://dcmetrohero.com/apis.

When using the CLI, provide your key via CLI argument or by setting the METROHERO_API_KEY environment variable.

Getting Started

To build, clone this repository and run:

git clone https://github.com/epikulski/metrohero-rs.git
cd metrohero-rs
cargo build
cargo test

Using the metrohero-rs CLI

Usage: metrohero_rs [OPTIONS] <COMMAND>

Commands:
  plan        Get information about a route
  departures  Get information about as station
  stations    Print a table of station names and their RTU code
  help        Print this message or the help of the given subcommand(s)

Options:
      --api-key <API_KEY>  MetroHero API key
  -h, --help               Print help information
  -V, --version            Print version information

Look up departures from a station

// Stations can be accessed by name
cargo run departures Rosslyn

// Or by their RTU code
cargo run departures C05
 Departures for Rosslyn (C05)
  +------+-----------------------+-----+-------+
  | Line | Destination           | ETA | Notes |
  +============================================+
  |  BL  | Franconia-Springfield | BRD |       |
  |------+-----------------------+-----+-------|
  |  SV  | Downtown Largo        | ARR |       |
  |------+-----------------------+-----+-------|
  |  BL  | Huntington            | 3m  |       |
  +------+-----------------------+-----+-------+
  Source: MetroHero API (https://www.dcmetrohero.com)

Look up trip durations between stations. (Does not support trips that require a transfer)

 cargo run plan Ballston Rosslyn
 Ballston --> Rosslyn
 Expected ride:    7m (normally 6m)
 Next train:       BRD, 9m, 17m, 12:03

 Departures from Ballston
 +------+----------------+-----+-------+
 | Line | Destination    | ETA | Notes |
 +=====================================+
 |  SV  | Downtown Largo | BRD |       |
 |------+----------------+-----+-------|
 |  OR  | New Carrollton | 9m  |       |
 |------+----------------+-----+-------|
 |  SV  | Downtown Largo | 17m |       |
 +------+----------------+-----+-------+

Look up a station's name or RTU code

cargo run stations | grep -i rosslyn
| C05  | Rosslyn                                          |

Using metrohero-rs as a Library

Library documentation is available at: https://epikulski.github.io/metrohero-rs/metrohero_rs/

About

A rust client for the MetroHero API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages