blob: fd02f82c49fb3f3438813085108406cada7b98f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
mod protos;
use protos::protos::gtfs_realtime::FeedMessage;
use protobuf::Message;
use clap::Parser;
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
/// uri of the GTFS RT feed to fetch & display
#[arg(long)]
url: String,
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let args = Args::parse();
let resp = reqwest::get(&args.url)
.await?
.bytes().await?;
let proto = FeedMessage::parse_from_bytes(&resp[..])?;
println!("{}", protobuf::text_format::print_to_string_pretty(&proto));
Ok(())
}
|