goog 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/goog +14 -1
  2. data/lib/goog.rb +1 -1
  3. metadata +1 -1
data/bin/goog CHANGED
@@ -8,12 +8,21 @@ require 'uri'
8
8
  if ARGV[0] =~ /^-h|--help/
9
9
  require 'goog'
10
10
  puts <<END
11
- Usage: goog [-n pages] [query]
11
+ Usage: goog [-n pages] [-d date range type] [query]
12
12
 
13
13
  Synopsis:
14
14
  -n [pages] Return n pages of results
15
+ -d [date range type] Limit results to date range (see below for codes)
15
16
  -h, --help Show this message
16
17
 
18
+ Date range types for -d option:
19
+
20
+ h last hour
21
+ d last day (24 hours)
22
+ w last week
23
+ m last month
24
+ y last year
25
+
17
26
  goog #{Goog::VERSION}
18
27
  http://github.com/danchoi/goog
19
28
  Author: Daniel Choi <dhchoi@gmail.com>
@@ -22,6 +31,7 @@ END
22
31
  end
23
32
 
24
33
  pages = ARGV[0] =~ /^-n/ ? (ARGV.shift && ARGV.shift[/\d+/,0].to_i) : 1
34
+ date_range = ARGV[0] =~ /^-d/ ? (ARGV.shift && ARGV.shift[/[hdwmy]/,0]) : nil
25
35
 
26
36
  query = ARGV.join(' ')
27
37
  unless query
@@ -35,6 +45,9 @@ if RUBY_VERSION !~ /^1.9/
35
45
  abort "Requires Ruby 1.9"
36
46
  end
37
47
  query = "/search?q=#{CGI.escape query}"
48
+ if date_range
49
+ query += "&as_qdr=#{date_range}"
50
+ end
38
51
  (1..pages).each do |page|
39
52
  if query.nil?
40
53
  exit
data/lib/goog.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Goog
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: