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
19
20
# File 'lib/crspec/transpiler/cli.rb', line 14

def initialize(args)
  @args = args
  @mode = :help
  @paths = []
  @diff = false
  @backup = true
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



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/crspec/transpiler/cli.rb', line 22

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