Class: BabelBot::CLI

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

Class Method Summary collapse

Class Method Details

.load_config(config_path) ⇒ Object



34
35
36
# File 'lib/babel_bot/cli.rb', line 34

def self.load_config(config_path)
  JSON.load(File.open(config_path))
end

.runObject



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

def self.run
  @opts = Slop.parse(help: true) do
    on '-v', 'Print the version' do
      puts "Version #{BabelBot::VERSION}"
    end

    command "generate-strings" do
      banner "Usage: babel-bot generate-strings CONFIG_PATH"
      run do |opts, args|
        if args[0]
          config = BabelBot::CLI.load_config(args[0])
          BabelBot::Runner.new(config).generate_strings
          exit
        end
      end
    end
  end

  puts @opts
  exit
end