Sha256: e723b7e3caa08c50fa79d815bfbc6df045ba5ddb478634207a189322b93927fd

Contents?: true

Size: 789 Bytes

Versions: 1

Compression:

Stored size: 789 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

# for dev purposes
require 'bundler/setup' if ENV['URL_FINDER_GEM_DEV']

require 'url_finder'
require 'optparse'

options = {}
OptionParser.new do |parser|
  parser.banner = 'Usage: url_finder --help'
  parser.default_argv = ARGV

  parser.on('--file=/path/to/file', String, 'Input file') do |string|
    options[:file] = string
  end

  parser.on('--format=file_format', String, 'Input format (html, markdown, csv, string)') do |string|
    options[:format] = string
  end

  parser.on('-h', '--help', 'How to use') do
    puts parser
    exit
  end
end.parse!

file = options.fetch(:file) { raise(ArgumentError, '--file is required') }
file_format = options[:format]

UrlFinder.from_file(file, file_format).each do |url|
  puts url
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
url_finder-0.1.0 exe/url_finder