mirror of
https://github.com/StrawberryMaster/wayback-machine-downloader.git
synced 2025-12-17 17:56:44 +00:00
Add only_filter flag option to the CLI
This commit is contained in:
parent
1a3ae8b931
commit
4d661d87a0
@ -18,8 +18,8 @@ option_parser = OptionParser.new do |opts|
|
||||
options[:timestamp] = t
|
||||
end
|
||||
|
||||
opts.on("--accept-regex [ACCEPT_REGEX]", String,"Specify a regular expression to download. If a path doesn't meet this regex, it won't get downloaded.") do |accept_regex|
|
||||
options[:accept_regex] = accept_regex
|
||||
opts.on("-o", "--only ONLY_FILTER", String, "Restrict downloading to file urls matching the only filter supplied (use // notation for the only filter to be treated as a regex)") do |t|
|
||||
options[:only_filter] = t
|
||||
end
|
||||
|
||||
opts.on("-v", "--version", "Display version") do |t|
|
||||
@ -27,11 +27,8 @@ option_parser = OptionParser.new do |opts|
|
||||
end
|
||||
end.parse!
|
||||
|
||||
# this used to be 0. we want to look at the /last/ option.
|
||||
#
|
||||
# TODO: this argument needs to be handled better. argument handling is sorta messy.
|
||||
if base_url = ARGV[-1]
|
||||
wayback_machine_downloader = WaybackMachineDownloader.new base_url: base_url, timestamp: options[:timestamp], accept_regex: options[:accept_regex]
|
||||
wayback_machine_downloader = WaybackMachineDownloader.new base_url: base_url, timestamp: options[:timestamp], only_filter: options[:only_filter]
|
||||
wayback_machine_downloader.download_files
|
||||
elsif options[:version]
|
||||
puts WaybackMachineDownloader::VERSION
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user