Class: Applyrics::CLI

Inherits:
Object
  • Object
show all
Includes:
Commander::Methods
Defined in:
lib/applyrics/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.startObject



8
9
10
# File 'lib/applyrics/cli.rb', line 8

def self.start
  new.run
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/applyrics/cli.rb', line 12

def run
  program :name, 'applyrics'
  program :version, Applyrics::VERSION
  program :description, Applyrics::DESCRIPTION
  program :help_formatter, :compact

  command :init do |c|
    c.syntax = "applyrics init"
    c.description = "Sets up the project"
    c.action do |args, options|
      puts "Not implemented yet... Sorry!"
    end
  end

  command :rebuild do |c|
    c.syntax = "applyrics rebuild"
    c.description = "Rebuilds language files for your project"
    c.option '--project STRING', String, 'Path to iOS or Android project'
    c.action do |args, options|
      options.default :project => './'
      puts "rebuilding..."
      project = Applyrics::Project.new()
      project.rebuild_files()
    end
  end

  command :apply do |c|
    c.syntax = "applyrics apply"
    c.description = "Applies language from a .json file"
    c.option '--project STRING', String, 'Path to iOS or Android project'
    c.option '--data STRING', String, 'Path to .json file (Default: lyrics.json)'
    c.action do |args, options|
      options.default :project => './', :data => './lyrics.json'
      puts "Not implemented yet... Sorry!"
    end
  end

  command :sync do |c|
    c.syntax = "applyrics sync"
    c.description = "Syncs language from applyrics.io"
    c.option '--project STRING', String, 'Path to iOS or Android project'
    c.action do |args, options|
      options.default :project => './'
      puts "Not implemented yet... Sorry!"
    end
  end

  run!
end