bin/web_grep in web_grep-1.0.2 vs bin/web_grep in web_grep-1.0.3
- old
+ new
@@ -20,10 +20,18 @@
opt.on('-u', '--url [url]', String, 'Search in URL: "ya.ru"') do |url|
options[:url] = url
end
+ opt.on('-q', '--quite', 'Show only xpaths') do |q|
+ options[:quite] = q
+ end
+
+ opt.on('-c', '--only-count', 'Show only count') do |c|
+ options[:only_count] = c
+ end
+
opt.on_tail('-v', '--version', 'Show version') do
puts WebGrep::VERSION
exit
end
@@ -33,12 +41,13 @@
opt.on { puts opt; exit }
end
end.parse!
greped = WebGrep::Grep.new(
- word: options[:word] || ARGV[0],
- url: options[:url ] || ARGV[1],
- file: options[:file]
+ word: options[:word] || ARGV[0],
+ url: options[:url ] || ARGV[1],
+ file: options[:file],
+ quite: options[:quite]
).grep!
-puts greped
+puts greped if !options[:only_count]
puts "#{"\033[32;1m"}Found #{greped.count}#{"\033[0m"}"
\ No newline at end of file