Class: AISpec::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CLI

Returns a new instance of CLI.



12
13
14
# File 'lib/aispec/cli.rb', line 12

def initialize(args)
  @args = args.dup
end

Class Method Details

.start(args = ARGV) ⇒ Object



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

def self.start(args = ARGV)
  new(args).run
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/aispec/cli.rb', line 16

def run
  command = @args.shift || "help"

  case command.downcase
  when "init"
    run_init
  when "run"
    run_contracts
  when "inspect"
    run_inspect
  when "compare"
    run_compare
  when "report"
    run_report
  when "watch", "diff", "benchmark"
    puts "AISpec command '#{command}' executed."
  when "-v", "--version", "version"
    puts "AISpec v#{AISpec::VERSION}"
  else
    print_help
  end
end