From 80a4af9f0a6f7e3bd2d8254f8bc8475ca73b8980 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Tue, 1 Feb 2022 17:41:56 +0100 Subject: display iceportal itinery & stops I'm pretty sure something in parsing the times is broken, since this train is currently /also/ broken I have absolutely no idea what the correct ones would be and don't have the energy to dig further into this. --- src/main.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 1712545..cb9ac6c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -159,12 +159,16 @@ fn main() -> Result<(), ureq::Error> { Command::ICEPortal => { match get_request::("https://iceportal.de/api1/rs/tripInfo/trip") { Ok(resp) => { - println!("{:?}", resp); + println!("{}: Currently in {}", traveltext, resp.get_train_ref()); println!("guessing last stop was: {:?}", resp.guess_last_station()); + println!("{}", resp.trip()) } - Err(_) => { + Err(err) => { + if cli.debug { + eprintln!("{:?}", err); + } println!("either this tool or the iceportal broke or you're not actually on an ICE\n\ - (get a response but couldn't to parse it)"); + (get a response but couldn't parse it)"); } } } -- cgit v1.2.3