Sha256: 44990ecf37b10c801a4b7a08b8f4c446937d8b9020db4ba61df5605fefc6d480

Contents?: true

Size: 780 Bytes

Versions: 2

Compression:

Stored size: 780 Bytes

Contents

#!/usr/bin/env ruby

require 'fileutils'
require 'optparse'
require 'methadone'
require_relative '../lib/download_files.rb'

class App
  include Methadone::Main
  include Methadone::CLILogging

  main do |page_address, pattern, directory|
    dir = if directory
      FileUtils.mkdir_p(directory) unless File.directory?(directory)
    else
      FileUtils.pwd
    end
    DownloadFiles.download_files(page_address, pattern, dir, logger)
  end

  # Declare command-line interface
  description "Downloads files from the web page at the given address on the given domain that match the given regular expression pattern."
  
  # Require an argument
  arg :page_address
  arg :pattern
  arg :directory, :optional
  
  version DownloadFiles::VERSION

  use_log_level_option

  go!
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
download_files-0.0.2 bin/download_files
download_files-0.0.1 bin/download_files