Class: TxOcr::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/tx_ocr/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



9
10
11
# File 'lib/tx_ocr/cli.rb', line 9

def self.source_root
  File.expand_path('../..', __dir__)
end

Instance Method Details

#configObject



14
15
16
17
18
19
20
21
22
# File 'lib/tx_ocr/cli.rb', line 14

def config

  config_path = Dir.home + '/.tx_ocr'
  if Dir.exist?(config_path)
    puts "Your current name is [#{TxOcr.config[:name]}]."
  else
    template 'templates/settings.yml.tt', "http://#{config_path}/settings.yml"
  end
end

#image(filename) ⇒ Object



25
26
27
# File 'lib/tx_ocr/cli.rb', line 25

def image(filename)
  puts TxOcr::Image.new(filename).indent_result
end

#url(url) ⇒ Object



30
31
32
# File 'lib/tx_ocr/cli.rb', line 30

def url(url)
  puts TxOcr::Text.new(url).indent_result
end