class Rouge::CLI::Highlight

def self.parse(argv)

def self.parse(argv)
  opts = {
    :formatter => 'terminal256',
    :input_file => '-',
    :lexer_opts => {},
    :formatter_opts => {},
  }
  until argv.empty?
    arg = argv.shift
    case arg
    when '--input-file', '-i'
      opts[:input_file] = argv.shift
    when '--mimetype', '-m'
      opts[:mimetype] = argv.shift
    when '--lexer', '-l'
      opts[:lexer] = argv.shift
    when '--formatter', '-f'
      opts[:formatter] = argv.shift
    when '--lexer-opts', '-L'
      opts[:lexer_opts] = parse_cgi(argv.shift)
    when '--formatter-opts', '-F'
      opts[:formatter_opts] = parse_cgi(argv.shift)
    when /^--/
      error! "unknown option #{arg.inspect}"
    else
      opts[:input_file] = arg
    end
  end
  new(opts)
end