Sha256: 36a0c000b531175c2af2067a09e00963ad94af837810a8e0c362dfdc606bbc03

Contents?: true

Size: 599 Bytes

Versions: 2

Compression:

Stored size: 599 Bytes

Contents

# frozen_string_literal: true

require "thor"

require "json"

module Tansaku
  class CLI < Thor
    desc "crawl URL", "Crawl a given URL"
    method_option :additional_list, desc: "Path to the file which includes additonal paths to crawl"
    method_option :threads, type: :numeric, desc: "Number of threads to use"
    method_option :user_agent, type: :string, desc: "User-Agent parameter to use"
    def crawl(url)
      params = options.compact.map { |k, v| [k.to_sym, v] }.to_h
      crawler = Crawler.new(url, params)
      results = crawler.crawl
      puts results.to_json
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tansaku-0.1.2 lib/tansaku/cli.rb
tansaku-0.1.1 lib/tansaku/cli.rb