#!/usr/bin/env ruby # encoding: UTF-8 require 'codesake' require 'rainbow' trap("INT") { puts '['+'INTERRUPTED'.color(:red)+']'; exit -1 } cli = Codesake::Cli.new kernel = Codesake::Kernel.instance options=cli.parse(ARGV) puts "codesake v#{Codesake::VERSION} - (C) 2012 - paolo@armoredcode.com".color(:white) unless options[:version] abort("codesake v#{Codesake::VERSION}") if options[:version] abort("codesake: #{cli.error_message}".color(:red)) if cli.has_errors? abort("codesake: missing targets".color(:red)) if cli.targets.nil? cli.targets.each do |target| puts "processing #{target[:target]}" if target[:valid] $stderr.puts "can't find #{target[:target]}".color(:red) if ! target[:valid] engine = kernel.choose_engine(target[:target], options) if ! options[:keywords].nil? options[:keywords].each do |key| engine.add(key) end end results = engine.analyse results.each do |res| $stdout.puts "#{res}" end end