From fc01e1e7478da73850e627d82f9e5aab6625709b Mon Sep 17 00:00:00 2001 From: Arnau Siches Date: Sat, 9 Apr 2016 14:34:50 +0100 Subject: [PATCH] Update README with the CLI approach --- README.md | 51 ++++++++++++++++++++++++++++++++++++++++++++++----- src/cmd.rs | 2 +- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 04e3671..a37b06e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,48 @@ -# Transit For London GTFS Exporter +# Transport For London GTFS Exporter -This simple rust program pulls data from the TFL Unified API -and converts it to a directory with GTFS files in it. +This simple Rust CLI allows you to fetch data from the +[Tfl Unified API][tfl-api] and transform it to [GTFS][gtfs]. -Clone and "cargo run --release" to generate a gtfs directory with all the -required .txt csv files. + +## Install + +Clone [the repository][tfl-cli] and compile: + +```sh +cargo build --release +``` + +*WARNING*: If you compile under OSX 10.11 you might need to specify the +OpenSSL include path. For example, having OpenSSL installed via Homebrew, +the command is: + +```sh +OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include cargo build --release +``` + +You will find the binary in `./target/release/`. + +## Usage + +Check the help `./target/release/tflgtfs help` for details. + +In short, you can fetch Tfl lines with the `fetch-lines` command and transform +the cached values with the `transform gtfs` command. + +You can do it in one shot via: + +```sh +./target/release/tflgtfs fetch-lines --format gtfs +``` + +You will find the resulting GTFS files inside `./gtfs`. + + +## License + +See [License](./LICENSE). + + +[tfl-cli]: https://github.com/CommuteStream/tflgtfs/ +[tfl-api]: https://api.tfl.gov.uk/ +[gtfs]: https://developers.google.com/transit/gtfs/ diff --git a/src/cmd.rs b/src/cmd.rs index 6241562..9c16161 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -83,7 +83,7 @@ fn transform_gtfs(lines: Vec) { line_count += 1; line_ids.insert(line.id.clone()); } - println!("Duplicate Lines: {}, Duplicate Route Sections: {}", line_count-line_ids.len(), route_section_count-route_section_ids.len()); + println!("Duplicate Lines: {}, Duplicate Route Sections: {}", line_count - line_ids.len(), route_section_count-route_section_ids.len()); println!("Schedule Names:"); for schedule_name in &schedule_names {