Sha256: 8db57577208743498781ccf451af6949abeb5933b5356ec10946e64253d2183e

Contents?: true

Size: 744 Bytes

Versions: 6

Compression:

Stored size: 744 Bytes

Contents

#!/usr/bin/env ruby
%w{rubygems platform cgi}.each {|library| require library}

if :macosx != Platform::IMPL
  abort "Utility Belt's command-line Google shortcut only works on OS X. Sorry."
else
  require "#{File.dirname(__FILE__) + '/../lib'}/mac_clipboard"
  search_term = ARGV[0] || MacClipboard.read
  if search_term.empty?
    puts "Usage: google search_term_without_spaces"
    puts "       google 'search term with spaces'"
    puts "       google"
    puts "              (if invoking without command-line args, must have text in clipboard)"
    puts "              (if you're seeing this there's a good chance you copied an image or something)"
    exit
  end
  system("open http://google.com/search?q=#{CGI.escape(search_term)}")
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
utility_belt-1.0.2 bin/google
utility_belt-1.0.1 bin/google
utility_belt-1.0.5 bin/google
utility_belt-1.0.3 bin/google
utility_belt-1.0.4 bin/google
utility_belt-1.0.6 bin/google