google 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/bin/google +3 -1
  2. data/lib/google.rb +44 -0
  3. metadata +1 -1
data/bin/google CHANGED
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'google'
3
+ require_relative '../lib/google'
4
+
5
+ # Trollop::die "This is a fancy trollop die message."
data/lib/google.rb CHANGED
@@ -1 +1,45 @@
1
+ require 'trollop'
2
+ require_relative 'google/utils'
3
+ require_relative 'google/search'
4
+ require_relative 'google/request'
5
+ require_relative 'google/display_serp'
1
6
 
7
+ opts = Trollop::options do
8
+ version "google v0.0.2 (c) 2012 Kerrick Long http://kerrick.github.com/google"
9
+ banner <<-EOM
10
+ The google gem is a simple tool to search Gooogle with via a CLI.
11
+ Usage:
12
+ google [options] "my search query string here"
13
+ where [options] are:
14
+ EOM
15
+
16
+ opt :page,
17
+ "Start by showing the <i>th result page.",
18
+ :type => :int,
19
+ :default => 1
20
+
21
+ opt :size,
22
+ "Show <i> results on each SERP. Must be between 1 and 8.",
23
+ :type => :int,
24
+ :default => 4
25
+
26
+ opt :result,
27
+ "Skip the SERP and show the <i>th result.",
28
+ :type => :int
29
+
30
+ opt :lucky,
31
+ "I'm feeling lucky! Skip the SERP and show the first result. " +
32
+ "(Alias to --result 1)"
33
+
34
+ opt :version,
35
+ "Print the version and exit."
36
+
37
+ opt :help,
38
+ "Show this information and exit."
39
+ end
40
+
41
+ query = ARGV.join(' ')
42
+ raise Trollop::die "no search query specified" if query.empty?
43
+
44
+ g = Google.new query, opts
45
+ g.search
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: