Class: Robro::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/robro/cli.rb,
lib/robro/cli/helpers.rb

Defined Under Namespace

Modules: Helpers

Instance Method Summary collapse

Instance Method Details

#browse(url) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/robro/cli.rb', line 11

def browse(url)
  uri = validate_url(url)

  Robro.browser = Browser.new options[:browser]
  Robro.browser.visit uri

  quit = false
  until quit
    us = UserScripts.find_for uri: uri

    unless us.nil?
      puts "Commands for this URL: #{us.supported_url_commands}"

      us.supported_url_commands.each do |command|
        define_singleton_method command do |*args|
          us.send(command, *args)
        end
      end
    end

    debugger
  end
end