Skip to content
Snippets Groups Projects
Commit 856ad6ce authored by Alex Reisner's avatar Alex Reisner
Browse files

Change CLI output format.

Show all globally-supported attributes in a table.
parent 83b6c743
No related branches found
No related tags found
No related merge requests found
......@@ -75,8 +75,18 @@ module Geocoder
end
if (result = Geocoder.search(query).first)
out << result.coordinates.join(',') + "\n"
out << result.address + "\n"
lines = [
["Latitude", :latitude],
["Longitude", :longitude],
["Full address", :address],
["City", :city],
["State/province", :state],
["Postal code", :postal_code],
["Country", :country],
]
lines.each do |line|
out << (line[0] + ": ").ljust(18) + result.send(line[1]).to_s + "\n"
end
exit 0
else
out << "Location '#{query}' not found.\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment