Sha256: a033e6d2db69a5a74377d4ff0bda61264cb95bc5f424d8bf6970526a678d2397
Contents?: true
Size: 1.77 KB
Versions: 2
Compression:
Stored size: 1.77 KB
Contents
#!/usr/bin/env ruby require 'optparse' require 'hosts_updater' options = { :sources => {} } OptionParser.new do |opts| opts.banner = "Usage: hosts-updater [options]" opts.on("-h", "--help", "Show this message") do puts opts exit end opts.on("-c", "--clear", "Clear all blacklisted hosts") do |clear| options[:clear] = clear end opts.on("--hosts-file [PATH]", "Path to hosts file to write (default: /etc/hosts)") do |file| options[:hosts_file] = file end opts.on("--hosts-directory [PATH]", "Path to hosts.d config directory (default: /etc/hosts.d/)") do |file| options[:hosts_dir] = file end opts.on("--hosts-auto-name [NAME]", "Name for auto-generated file in hosts.d dir (default: hosts.auto)") do |file| options[:hosts_auto_name] = file end opts.on("--hosts-custom-name [NAME]", "Name for custom hosts file in hosts.d dir (default: hosts.custom)") do |file| options[:hosts_custom_name] = file end opts.on("--hosts-whitelist-name [NAME]", "Name for file with whitelisted domains in hosts.d dir (defaule: hosts.whitelist)") do |file| options[:hosts_whitelist_name] = file end opts.on("-i", "--ip", "Redirect all blacklisted domains to following IP (default: 0.0.0.0)") do |ip| options[:id] = ip end opts.on("-u", "--[no-]update", "Update sources") do |u| options[:update] = u end HostsUpdater::SOURCES.each do |source_key, source_data| opts.on("--skip-#{source_key}", "Skip downloading #{source_data[1]} (#{source_data[0]})") do |s| options[:sources][source_key] = false end end opts.on("-q", "--quiet", "Run completely silently") do |q| options[:quiet] = q end opts.on("-v", "--[no-]verbose", "Run verbosely") do |v| options[:verbose] = v end end.parse! HostsUpdater.new(options).run
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hosts_updater-1.0.4 | bin/hosts-updater |
hosts_updater-1.0.3 | bin/hosts-updater |