Sha256: 839a5dc955796d5b4372455a9dcb5dcf06c7be750bc21ed65be097f0b4a81558
Contents?: true
Size: 919 Bytes
Versions: 2
Compression:
Stored size: 919 Bytes
Contents
#!/usr/bin/env ruby # Google search CLI browser that can open links into a browser. require 'bundler/setup' require 'slop' require_relative '../lib/google-browse' # Manage CLI options. results_per_page = GoogleBrowse::Browser::DEFAULT_RESULTS_PER_PAGE opts = Slop.parse help: true do banner <<-END_OF_TEXT Google Browse v#{GoogleBrowse::VERSION} Usage: #{File.basename $0} [OPTIONS] Options: END_OF_TEXT on 'q=', 'query=', "Initial search query" on 'n=', 'number=', "Number of results per page (default: #{results_per_page})", as: Integer, default: results_per_page end exit 0 if opts.help? def cli_error(opts, message) puts "ERROR: #{message}" puts puts opts exit 0 end cli_error opts, 'Must have 1 or more results per page!' unless opts[:number] >= 1 puts puts "Google Browse v#{GoogleBrowse::VERSION}" GoogleBrowse.search query: opts[:query], results_per_page: opts[:number]
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
google-browse-0.2.0 | bin/google-browse |
google-browse-0.1.3 | bin/google-browse |