From 776448be29cc59b5b63f19a2c82869b486f6029c Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Fri, 21 Dec 2012 16:28:12 -0500 Subject: [PATCH] Fix bug in CLI's handling of multi-part keys. --- lib/geocoder/cli.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/geocoder/cli.rb b/lib/geocoder/cli.rb index 3aed9253..f564efa5 100644 --- a/lib/geocoder/cli.rb +++ b/lib/geocoder/cli.rb @@ -13,10 +13,9 @@ module Geocoder opts.separator "\nOptions: " opts.on("-k <key>", "--key <key>", - "Key for geocoding API (optional for most). For Google Premier use 'key client channel' separated by spaces") do |key| - premier_key = key.split(' ') - if premier_key.length == 3 - Geocoder.configure(:api_key => premier_key) + "Key for geocoding API (usually optional). Enclose multi-part keys in quotes and separate parts by spaces") do |key| + if (key_parts = key.split(' ')).size > 1 + Geocoder.configure(:api_key => key_parts) else Geocoder.configure(:api_key => key) end -- GitLab