goog 0.2.8 → 0.2.9
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.
- data/bin/goog +6 -17
- data/lib/goog.rb +1 -1
- data/plugin/goog.vim +1 -3
- metadata +2 -2
data/bin/goog
CHANGED
@@ -7,17 +7,6 @@ require 'uri'
|
|
7
7
|
require 'optparse'
|
8
8
|
|
9
9
|
$vimscript_file = File.expand_path(File.join(File.dirname(__FILE__), '..', 'plugin', 'goog.vim'))
|
10
|
-
|
11
|
-
html_dump_program = if (`which w3m` != "")
|
12
|
-
"w3m -dump"
|
13
|
-
elsif (`which elinks` != "")
|
14
|
-
"elinks -dump -no-numbering"
|
15
|
-
elsif (`which links` != "")
|
16
|
-
"links -dump"
|
17
|
-
elsif (`which lynx` != "")
|
18
|
-
"lynx -dump -nonumber"
|
19
|
-
end
|
20
|
-
|
21
10
|
orig_query = "query: #{ARGV.join(' ')}\n\n"
|
22
11
|
options = {}
|
23
12
|
OptionParser.new do |opts|
|
@@ -35,7 +24,7 @@ DATE RANGE options for -d option:
|
|
35
24
|
|
36
25
|
VIM KEY MAPPINGS
|
37
26
|
<leader>o open URL on or after cursor in default external web browser
|
38
|
-
<leader>O open URL on or after cursor in split Vim window using
|
27
|
+
<leader>O open URL on or after cursor in split Vim window using elinks, links, or lynx
|
39
28
|
|
40
29
|
VIM PLUGIN COMMANDS
|
41
30
|
|
@@ -52,7 +41,7 @@ In the GoogSearchResults buffer:
|
|
52
41
|
CTRL-j jumps to the next URL
|
53
42
|
CTRL-k jumps to the previous URL
|
54
43
|
<leader>o open URL on or after cursor in default external web browser
|
55
|
-
<leader>O open URL on or after cursor in split Vim window using
|
44
|
+
<leader>O open URL on or after cursor in split Vim window using elinks, links, or lynx
|
56
45
|
|
57
46
|
goog #{Goog::VERSION}
|
58
47
|
http://github.com/danchoi/goog
|
@@ -64,7 +53,7 @@ END
|
|
64
53
|
opts.on("-n", '--num-pages [NUM PAGES]', 'Show NUM PAGES pages of results') {|pages| options[:pages] = pages.to_i }
|
65
54
|
opts.on("-c", '--color', 'Force color output') {options[:color] = true}
|
66
55
|
opts.on("-x", '--expand', 'Expand all results into web page text') { options[:expand] = true }
|
67
|
-
opts.on("-e", '--elinks', 'Open results in
|
56
|
+
opts.on("-e", '--elinks', 'Open results in elinks') { options[:elinks] = true }
|
68
57
|
opts.on("-i", '--interactive', 'Prompt for selection') { options[:interactive] = true }
|
69
58
|
opts.on("-v", '--vim', 'Open results in Vim and bind <leader>o to open URL on or after cursor') { options[:vim] = true }
|
70
59
|
opts.on('--install-plugin', 'Install Goog as a Vim plugin') {
|
@@ -146,7 +135,7 @@ links = []
|
|
146
135
|
if options[:expand]
|
147
136
|
$stderr.puts "Fetching #{title}: #{link}"
|
148
137
|
puts "#{title}: #{link}"
|
149
|
-
puts
|
138
|
+
puts `elinks -dump -no-numbering '#{link}'`
|
150
139
|
puts '-' * 80
|
151
140
|
puts
|
152
141
|
end
|
@@ -177,13 +166,13 @@ if options[:interactive]
|
|
177
166
|
n = s[/\d+/,0].to_i
|
178
167
|
pipe = s[/[|>].*$/,0] || '| less'
|
179
168
|
link = links[n - 1]
|
180
|
-
cmd = "(echo \"#{link}\n\n\";
|
169
|
+
cmd = "(echo \"#{link}\n\n\"; elinks -dump -no-numbering '#{link}') #{pipe}"
|
181
170
|
system cmd
|
182
171
|
}
|
183
172
|
end
|
184
173
|
|
185
174
|
if options[:elinks]
|
186
175
|
$stdout.close
|
187
|
-
exec "mv #{$tempfile.path}{,.html} &&
|
176
|
+
exec "mv #{$tempfile.path}{,.html} && elinks #{$tempfile.path}.html"
|
188
177
|
end
|
189
178
|
|
data/lib/goog.rb
CHANGED
data/plugin/goog.vim
CHANGED
@@ -12,9 +12,7 @@ let s:http_link_pattern = '^https\?:[^ >)\]]\+'
|
|
12
12
|
|
13
13
|
let g:gui_web_browser = system("echo -n $(which gnome-open || which open)")
|
14
14
|
if ! exists("g:text_web_browser")
|
15
|
-
if executable("
|
16
|
-
let g:text_web_browser = 'w3m -dump'
|
17
|
-
elseif executable("elinks")
|
15
|
+
if executable("elinks")
|
18
16
|
let g:text_web_browser = 'elinks -dump -no-numbering'
|
19
17
|
elseif executable("lynx")
|
20
18
|
let g:text_web_browser = 'lynx -dump -nonumbers'
|
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.2.
|
4
|
+
version: 0.2.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|