Class: Crspec::Transpiler::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CLI

Returns a new instance of CLI.



14
15
16
17
18
# File 'lib/crspec/transpiler/cli.rb', line 14

def initialize(args)
  @args = args
  @mode = :help
  @paths = []
end

Class Method Details

.run(args) ⇒ Object



10
11
12
# File 'lib/crspec/transpiler/cli.rb', line 10

def self.run(args)
  new(args).run
end

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/crspec/transpiler/cli.rb', line 20

def run
  parse_options
  case @mode
  when :analyze
    analyze_paths(@paths)
  when :write
    write_paths(@paths)
  else
    puts "Usage: crspec-transpile [--analyze|--write] <files or directories>"
  end
end