# File lib/turn/command.rb, line 245
    def main(*argv)
      option_parser.parse!(argv)

      @loadpath = ['lib'] if loadpath.empty?

      tests = ARGV.empty? ? nil : argv.dup

      #config = Turn::Configuration.new do |c|
      config = Turn.config do |c|
        c.live      = live
        c.log       = log
        c.loadpath  = loadpath
        c.requires  = requires
        c.tests     = tests
        c.runmode   = runmode
        c.format    = outmode
        c.pattern   = pattern
        c.matchcase = matchcase
        c.trace     = trace
        c.natural   = natural
        c.verbose   = verbose
        c.mark      = mark
        c.ansi      = ansi unless ansi.nil?
      end

      controller = Turn::Controller.new(config)

      result = controller.start

      if result
        exit (result.passed? ? 0 : -1)
      else # no tests
        exit -1
      end
    end