From 50128a64a6aeea41191039eb547a774b59d98dc8 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Tue, 4 Jun 2019 01:02:04 +0000 Subject: [PATCH] display travel time in output of "nearby" command --- commands.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index 807f368..417e1df 100644 --- a/commands.go +++ b/commands.go @@ -128,11 +128,12 @@ func NearbyCommand(sys *System) Command { return } c.Printf("--------------------------------------------------------------------------------\n") - c.Printf("%-4s %-20s %s\n", "id", "name", "distance") + c.Printf("%-4s %-20s %-12s %s\n", "id", "name", "distance", "trip time") c.Printf("--------------------------------------------------------------------------------\n") for _, neighbor := range neighbors { other := index[neighbor.id] - c.Printf("%-4d %-20s %-5.6v\n", other.id, other.name, neighbor.distance) + dur := NewTravel(c, sys, other).(*TravelState).tripTime() + c.Printf("%-4d %-20s %-12.6v %v\n", other.id, other.name, neighbor.distance, dur) } c.Printf("--------------------------------------------------------------------------------\n") }