diff --git a/Commands/App Store Link.tmCommand b/Commands/App Store Link.tmCommand index 5c268a5..80b90c8 100644 --- a/Commands/App Store Link.tmCommand +++ b/Commands/App Store Link.tmCommand @@ -9,14 +9,15 @@ SUPPORT = ENV['TM_SUPPORT_PATH'] DIALOG = ENV['DIALOG'] require SUPPORT + '/lib/escape' +require SUPPORT + '/lib/ui' require SUPPORT + '/lib/osx/plist' require SUPPORT + '/lib/exit_codes' require 'erb' require 'net/http' phrase = STDIN.read - -escapedUrl = "http://beta.appspace.com/apps/find/#{e_url(phrase.strip)}/" +keyword = phrase.empty? ? TextMate::UI.request_string(:title => "Enter keywords",:prompt => "Find App Store link for:") : phrase +escapedUrl = "http://beta.appspace.com/apps/find/#{e_url(keyword.strip)}/" res = Net::HTTP.get_response(URI.parse(escapedUrl)).body apps = [] @@ -48,9 +49,9 @@ id = scrape.match(/viewSoftware%3Fid%3D(\d+)/)[1] price = scrape.match(/buy_button">\$(\d+\.\d\d)/)[1].to_s url = "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=#{id}&mt=8" -input = "#{sel}" +input = phrase.empty? ? sel : phrase -if !(ENV['TM_SCOPE'].scan(/markdown/).empty?) && ENV['TM_CURRENT_LINE'] =~ /^(\s+)?$/ +if !(ENV['TM_SCOPE'].scan(/markdown/).empty?) && ENV['TM_CURRENT_LINE'] =~ /^(#{phrase})?(\s+)?$/ print ERB.new(ENV['TM_REF_LINK_FORMAT']).result else print ERB.new(ENV['TM_BLINK_FORMAT']).result @@ -59,6 +60,8 @@ end + fallbackInput + word input selection keyEquivalent diff --git a/info.plist b/info.plist index da6b380..cd6d5ae 100644 --- a/info.plist +++ b/info.plist @@ -14,7 +14,6 @@ 6C1B5472-C629-439C-BC50-560EB3766C19 F7332367-4230-444D-AE21-5BAD1E5F6A2E 1E8D16F5-4FD0-47D6-9C8B-62EDFE2733CF - 165B02E9-40F9-4444-B9EA-1C9561D7980A mainMenu