Class: LgtmCreator::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/lgtm_creator/cli.rb

Instance Method Summary collapse

Instance Method Details

#convert(src, dst = '') ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/lgtm_creator/cli.rb', line 9

def convert(src, dst = '')
  dst = LgtmCreator::Util.autoname(src) if options[:autoname]
  if options[:r]
    Dir.glob(src + '/*').each do |filename|
      next unless filename =~ /\.gif$/
      autoname = LgtmCreator::Util.autoname(filename)
      LgtmCreator::Core.convert(filename, autoname)
    end
  else
    if dst.empty?
      puts 'Please specify a file name'
      return
    end
    LgtmCreator::Core.convert(src, dst)
  end
end