Class: Traduki::CLI

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

Instance Method Summary collapse

Instance Method Details

#clean(path = nil) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/traduki/cli.rb', line 38

def clean(path = nil)
  generator = UserInterface.generator path
  generator.generate
  generator.scan
  UserInterface.print_garbage generator if options[:verbose]
  UserInterface.clean_check generator
  print 'Remove all keys and files are not present in your code files? [y/N]'.color :yellow
  UserInterface.clean generator if STDIN.gets.chomp =~ /^[Yy]/
end

#extract(path = nil) ⇒ Object



50
51
52
53
54
# File 'lib/traduki/cli.rb', line 50

def extract(path = nil)
  Traduki.config.workdir = path.dup if path
  Traduki.config.create_config
  puts 'Config file has beed put at ' + Traduki.config.workdir + '/traduki.yml'
end

#generate(path = nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/traduki/cli.rb', line 20

def generate(path = nil)
  puts "\n"
  generator = UserInterface.generator path
  generator.generate options[:clean]
  if options[:verbose]
    generator.parser.keys.each do |p, ks|
      ks.each do |k|
        puts k[0].color(:blue) + ' - ' + p
      end
    end
  end

  puts "#{generator.parser.keys_count} keys has been found and collected.".color(:green)
  puts "\n"
end

#versionObject



14
15
16
# File 'lib/traduki/cli.rb', line 14

def version
  puts Traduki::VERSION
end