feat(nav): helpful error for unknown destinations

This commit is contained in:
Lt. Byte 2026-09-03 09:47:00 +02:00
commit 4e43c5e060

3
nav.py
View file

@ -56,6 +56,9 @@ def plan(destination):
def main(): def main():
destination = sys.argv[1] destination = sys.argv[1]
if destination not in ROUTES:
known = ", ".join(sorted(ROUTES))
sys.exit(f"Unknown destination: {destination} (known: {known})")
route, total, days, fuel = plan(destination) route, total, days, fuel = plan(destination)
print("Route: " + " -> ".join(NAMES[w] for w in route)) print("Route: " + " -> ".join(NAMES[w] for w in route))
print(f"Distance: {total:.1f} million km") print(f"Distance: {total:.1f} million km")