Processes tree and detects options.

@param {Array} tree
@param {Array} handlers List of options that we should look for
@returns {Object} Map with detected options and all variants of possible
values
function detectInTree(tree, handlers) {
  var detectedOptions = {};
  // We walk across complete tree for each handler,
  // because we need strictly maintain order in which handlers work,
  // despite fact that handlers work on different level of the tree.
  handlers.forEach(function(handler) {
    detectedOptions[handler.name] = handler.detect(tree);
  });
  return detectedOptions;
}