goog 0.2.3 → 0.2.4
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 +5 -5
 - data/lib/goog.rb +1 -1
 - metadata +1 -1
 
    
        data/bin/goog
    CHANGED
    
    | 
         @@ -54,9 +54,9 @@ END 
     | 
|
| 
       54 
54 
     | 
    
         
             
              opts.on("-c", '--color', 'Force color output') {options[:color] = true}
         
     | 
| 
       55 
55 
     | 
    
         
             
              opts.on("-x", '--expand', 'Expand all results into web page text') { options[:expand] = true }
         
     | 
| 
       56 
56 
     | 
    
         
             
              opts.on("-e", '--elinks', 'Open results in elinks') { options[:elinks] = true }
         
     | 
| 
       57 
     | 
    
         
            -
              opts.on("- 
     | 
| 
      
 57 
     | 
    
         
            +
              opts.on("-i", '--interactive', 'Prompt for selection') { options[:interactive] = true }
         
     | 
| 
       58 
58 
     | 
    
         
             
              opts.on("-v", '--vim', 'Open results in Vim and bind <leader>o to open URL on or after cursor') { options[:vim] = true }
         
     | 
| 
       59 
     | 
    
         
            -
              opts.on( 
     | 
| 
      
 59 
     | 
    
         
            +
              opts.on('--install-plugin', 'Install Goog as a Vim plugin') {
         
     | 
| 
       60 
60 
     | 
    
         
             
                puts "Installing goog.vim into your ~/.vim/plugin directory."
         
     | 
| 
       61 
61 
     | 
    
         
             
                `cp #{$vimscript_file} #{ENV['HOME']}/.vim/plugin/`
         
     | 
| 
       62 
62 
     | 
    
         
             
                puts "Done. Type goog -h for Vim commands."
         
     | 
| 
         @@ -73,7 +73,7 @@ END 
     | 
|
| 
       73 
73 
     | 
    
         
             
              }
         
     | 
| 
       74 
74 
     | 
    
         
             
            end.parse!
         
     | 
| 
       75 
75 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
            if options[:elinks] || options[:vim] || options[: 
     | 
| 
      
 76 
     | 
    
         
            +
            if options[:elinks] || options[:vim] || options[:interactive]
         
     | 
| 
       77 
77 
     | 
    
         
             
              require 'tempfile'
         
     | 
| 
       78 
78 
     | 
    
         
             
              $tempfile = Tempfile.new('goog')
         
     | 
| 
       79 
79 
     | 
    
         
             
              $stdout = $tempfile
         
     | 
| 
         @@ -125,7 +125,7 @@ links = [] 
     | 
|
| 
       125 
125 
     | 
    
         
             
                number = (page - 1) * 10 + (index + 1)
         
     | 
| 
       126 
126 
     | 
    
         
             
                res = if options[:elinks]
         
     | 
| 
       127 
127 
     | 
    
         
             
                  %Q| <p>#{number}. <strong>#{title}</strong><br/>#{excerpt}<br/><a href='#{link}'>#{link}</a></p> |
         
     | 
| 
       128 
     | 
    
         
            -
                elsif !options[:vim] && (STDOUT.tty? || options[: 
     | 
| 
      
 128 
     | 
    
         
            +
                elsif !options[:vim] && (STDOUT.tty? || options[:interactive] || options[:color])
         
     | 
| 
       129 
129 
     | 
    
         
             
                  ["#{number}. \e[36m#{title}\e[0m", excerpt, "\e[35m#{link }\e[0m"].compact
         
     | 
| 
       130 
130 
     | 
    
         
             
                else
         
     | 
| 
       131 
131 
     | 
    
         
             
                  ["#{number}. #{title}", excerpt, link].compact
         
     | 
| 
         @@ -153,7 +153,7 @@ if options[:vim] 
     | 
|
| 
       153 
153 
     | 
    
         
             
              exec "vim -S #$vimscript_file -c 'call g:Goog_set_up_search_results_buffer()' #{$tempfile.path}"
         
     | 
| 
       154 
154 
     | 
    
         
             
            end
         
     | 
| 
       155 
155 
     | 
    
         | 
| 
       156 
     | 
    
         
            -
            if options[: 
     | 
| 
      
 156 
     | 
    
         
            +
            if options[:interactive]
         
     | 
| 
       157 
157 
     | 
    
         
             
              $stdout.close
         
     | 
| 
       158 
158 
     | 
    
         
             
              $stdout = STDOUT
         
     | 
| 
       159 
159 
     | 
    
         
             
              loop {
         
     | 
    
        data/lib/goog.rb
    CHANGED