class HttpFind::Cli
Public Class Methods
new()
click to toggle source
# File lib/http_find/cli.rb, line 5 def initialize @options = {} gather_opts end
Public Instance Methods
find(uri, term)
click to toggle source
# File lib/http_find/cli.rb, line 10 def find(uri, term) subject = @options[:regexp] ? /#{term}/ : term HttpFind.find(uri, subject).each { |l| puts l } end
Private Instance Methods
gather_opts()
click to toggle source
# File lib/http_find/cli.rb, line 17 def gather_opts OptionParser.new do |opts| opts.banner = "Usage: httpfind [options] URI TERM" opts.on("-e", "--regexp", "Indicate that TERM is a regular expression") do |e| options[:regexp] = e end opts.on("-v", "--version", "Show version info") do puts "httpfind #{HttpFind::VERSION}" exit end opts.on("-h", "--help", "Display this message") do puts opts exit end end.parse! end