add --exclude filter

- add exclude filter. Has precedence over the --only filter.
- bumped the version.
- tests: I modified the tests, but.. the whole suite is hopelessly broken. And when I say hopeless, I'm talking about myself; my Ruby is so rudimentary I was looking up how to create a variable. It really needs a static list of the website 'contents' mocked into it. I have a branch in my repo showing my hopeless work.
This commit is contained in:
tedder
2016-06-28 23:27:36 -07:00
parent 7000035a30
commit 1eaa8098c0
2 changed files with 28 additions and 6 deletions

View File

@@ -22,13 +22,17 @@ option_parser = OptionParser.new do |opts|
options[:only_filter] = t
end
opts.on("-x", "--exclude EXCLUDE_FILTER", String, "Skip urls that match this filter (use // notation for the filter to be treated as a regex)") do |t|
options[:exclude_filter] = t
end
opts.on("-v", "--version", "Display version") do |t|
options[:version] = t
end
end.parse!
if (base_url = ARGV[-1])
wayback_machine_downloader = WaybackMachineDownloader.new base_url: base_url, timestamp: options[:timestamp], only_filter: options[:only_filter]
wayback_machine_downloader = WaybackMachineDownloader.new base_url: base_url, timestamp: options[:timestamp], only_filter: options[:only_filter], exclude_filter: options[:exclude_filter]
wayback_machine_downloader.download_files
elsif options[:version]
puts WaybackMachineDownloader::VERSION