         return res
       )
 
+###*
+ * Reads an index by its name (file in indexes/index.[name].json)
+ * @param {string} name Name of the index to read
+###
+readIndex = (name) ->
+  for directory in atom.project.getDirectories()
+    crypt = md5(directory.path)
+    path = __dirname + "/../../indexes/" + crypt + "/index." + name + ".json"
+
+    try
+      fs.accessSync(path, fs.F_OK | fs.R_OK)
+    catch err
+      return []
+
+    options =
+      encoding: 'UTF-8'
+    return JSON.parse(fs.readFileSync(path, options))
+
+    break
+
+###*
+ * Throw a formatted error
+ * @param {object} error Error to show
+###
 printError = (error) ->
   data.error = true
   message = error.message

  throw new Error(message)

module.exports =
  clearCache: () ->
    data =
      error: false,

exec = require "child_process"
config = require "../config.coffee"
md5 = require 'MD5'
fs = require 'fs'

data =
  statics: [],
  methods: []

###*
 * Executes a command to PHP proxy
 * @param  {string}  command Command to exectue
 * @param  {boolean} async   Must be async or not
 * @return {array}           Json of the response
###
execute = (command, async) ->
  return [] if data.error?

