mirror of
https://github.com/StrawberryMaster/wayback-machine-downloader.git
synced 2025-12-17 17:56:44 +00:00
Fix CLI options set up
This commit is contained in:
parent
faa37d40fc
commit
ea6751bfbf
@ -9,20 +9,24 @@ option_parser = OptionParser.new do |opts|
|
||||
opts.banner = "Usage: wayback_machine_downloader http://example.com"
|
||||
|
||||
opts.separator ""
|
||||
opts.separator "Download any website from the Wayback Machine."
|
||||
opts.separator "Download an entire website from the Wayback Machine."
|
||||
|
||||
opts.separator ""
|
||||
opts.separator "Optional options:"
|
||||
|
||||
opts.on("-t", "--timestamp TIMESTAMP", Integer, "Only files on or before timestamp supplied (ie. 20150806225358)") do |t|
|
||||
options[:timestamp] = t
|
||||
opts.on("-f", "--from TIMESTAMP", Integer, "Only files on or after timestamp supplied (ie. 20060716231334)") do |t|
|
||||
options[:from_timestamp] = t
|
||||
end
|
||||
|
||||
opts.on("-t", "--to TIMESTAMP", Integer, "Only files on or before timestamp supplied (ie. 20100916231334)") do |t|
|
||||
options[:to_timestamp] = t
|
||||
end
|
||||
|
||||
opts.on("-o", "--only ONLY_FILTER", String, "Restrict downloading to urls that match this filter (use // notation for the filter to be treated as a regex)") do |t|
|
||||
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|
|
||||
opts.on("-x", "--exclude EXCLUDE_FILTER", String, "Skip downloading of urls that match this filter (use // notation for the filter to be treated as a regex)") do |t|
|
||||
options[:exclude_filter] = t
|
||||
end
|
||||
|
||||
@ -32,7 +36,8 @@ option_parser = OptionParser.new do |opts|
|
||||
end.parse!
|
||||
|
||||
if (base_url = ARGV[-1])
|
||||
wayback_machine_downloader = WaybackMachineDownloader.new base_url: base_url, timestamp: options[:timestamp], only_filter: options[:only_filter], exclude_filter: options[:exclude_filter]
|
||||
options[:base_url] = base_url
|
||||
wayback_machine_downloader = WaybackMachineDownloader.new options
|
||||
wayback_machine_downloader.download_files
|
||||
elsif options[:version]
|
||||
puts WaybackMachineDownloader::VERSION
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user