summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorstuebinm2022-02-01 17:41:56 +0100
committerstuebinm2022-02-01 17:42:59 +0100
commit80a4af9f0a6f7e3bd2d8254f8bc8475ca73b8980 (patch)
treea2077ce6d328f2b94d0394fa1590c0cc5feac6fe /src/main.rs
parentaacb2d78a4a97e3e8d7fdff4c06cba8be5f3139f (diff)
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.
Diffstat (limited to '')
-rw-r--r--src/main.rs10
1 files changed, 7 insertions, 3 deletions
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::<TripInfo>("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)");
}
}
}