bin/proxy_fetcher in proxy_fetcher-0.3.0 vs bin/proxy_fetcher in proxy_fetcher-0.3.1

- old
+ new

@@ -2,10 +2,11 @@ require 'optparse' require 'proxy_fetcher' options = { + filters: {}, validate: true, json: false } OptionParser.new do |opts| @@ -31,10 +32,16 @@ opts.on('-n', '--no-validate', '# Dump all the proxies without validation') do options[:validate] = false end + opts.on('-f', '--filters={}', String, '# Filters for proxy provider in JSON format') do |filters| + require 'json' + + options[:filters] = JSON.parse(filters) + end + opts.on('-t', '--timeout=SECONDS', Integer, '# Connection timeout in seconds') do |value| options[:timeout] = value end opts.on('-j', '--json', '# Dump proxies to the JSON format') do @@ -43,10 +50,10 @@ end.parse! ProxyFetcher.config.provider = options[:provider] if options[:provider] ProxyFetcher.config.connection_timeout = options[:timeout] if options[:timeout] -manager = ProxyFetcher::Manager.new +manager = ProxyFetcher::Manager.new(filters: options[:filters]) manager.validate! if options[:validate] if options[:json] require 'json'