Class: Spektr::Cli

Inherits:
Object
  • Object
show all
Includes:
TTY::Option
Defined in:
lib/spektr/cli.rb

Instance Method Summary collapse

Instance Method Details

#scanObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/spektr/cli.rb', line 45

def scan
  if params[:help]
    print help
    exit
  else
    ignore = params[:ignore] ? params[:ignore].split(',') : []
    report = Spektr.run(params[:root], params[:output_format], params[:debug], params[:check], ignore)
    case params[:output_format]
    when 'json'
      puts JSON.pretty_generate report
      exit 1 if report[:advisories].any?
    end
  end
end