google-browse 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/bin/google-browse +10 -5
- data/lib/google_browse/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
data/bin/google-browse
CHANGED
@@ -10,7 +10,15 @@ require_relative '../lib/google-browse'
|
|
10
10
|
# Manage CLI options.
|
11
11
|
results_per_page = GoogleBrowse::Browser::DEFAULT_RESULTS_PER_PAGE
|
12
12
|
opts = Slop.parse help: true do
|
13
|
-
banner
|
13
|
+
banner <<-END_OF_TEXT
|
14
|
+
Google Browse v#{GoogleBrowse::VERSION}
|
15
|
+
|
16
|
+
Usage: #{File.basename $0} [OPTIONS]
|
17
|
+
|
18
|
+
Options:
|
19
|
+
END_OF_TEXT
|
20
|
+
|
21
|
+
on 'q=', 'query=', "Initial search query"
|
14
22
|
|
15
23
|
on 'n=', 'number=',
|
16
24
|
"Number of results per page (default: #{results_per_page})",
|
@@ -28,13 +36,10 @@ end
|
|
28
36
|
|
29
37
|
cli_error opts, 'Must have 1 or more results per page!' unless opts[:number] >= 1
|
30
38
|
|
31
|
-
# BUG: No idea why the -n option STAYS in argv ;(
|
32
|
-
query = ARGV.empty? ? nil : ARGV.join(" ")
|
33
|
-
|
34
39
|
puts
|
35
40
|
puts "Google Browse v#{GoogleBrowse::VERSION}"
|
36
41
|
|
37
|
-
GoogleBrowse.search query: query, results_per_page: opts[:number]
|
42
|
+
GoogleBrowse.search query: opts[:query], results_per_page: opts[:number]
|
38
43
|
|
39
44
|
|
40
45
|
|