index.js
function getModulesAnswered(command, argv, globs) {
  let modulesCalled = {};
  let modulesAnswered = [];

  globs.forEach(pkg => {
    const dirName = path.dirname(pkg);
    let pkgJson = {};
    let module;

    try {
      module = require(dirName);
      pkgJson = require(pkg);
    } catch (err) {
      logger.verbose(`Error loading module: ${pkg}`);
    }

    if (module && typeof module.runCommand === 'function') {
      const pkgName = pkgJson.name || dirName;

      if (modulesCalled[pkgName]) {
        logger.verbose(`Multiple instances found. Skipping passing command to ${pkgName}`);
      } else {
        logger.verbose(`Passing command to ${pkgName}`);

        modulesCalled[pkgName] = true;
        if (module.runCommand(command, argv)) {
          modulesAnswered.push(pkgName);
        }

      }
    }
  });

  return modulesAnswered;
}
function getModulesAnswered(command, argv, globs) {
  let modulesCalled = {};
  let modulesAnswered = [];

  globs.forEach(pkg => {
    const dirName = path.dirname(pkg);
    let pkgJson = {};
    let module;

    try {
      module = require(dirName);
      pkgJson = require(pkg);
    } catch (err) {
      logger.verbose(`Error loading module: ${pkg}`);
    }

    if (module && typeof module.runCommand === 'function') {
      const pkgName = pkgJson.name || dirName;

      if (modulesCalled[pkgName]) {
        logger.verbose(`Multiple instances found. Skipping passing command to ${pkgName}`);
      } else {
        logger.verbose(`Passing command to ${pkgName}`);

        modulesCalled[pkgName] = true;
        if (module.runCommand(command, argv)) {
          modulesAnswered.push(pkgName);
        }

      }
    }
  });

  return modulesAnswered;
}
function getModulesAnswered ( command , argv , globs ) { let modulesCalled = { } ; let modulesAnswered = [ ] ; globs . forEach ( pkg => { const dirName = path . dirname ( pkg ) ; let pkgJson = { } ; let module ; try { module = require ( dirName ) ; pkgJson = require ( pkg ) ; } catch ( err ) { logger . verbose ( ` ${ pkg } ` ) ; } if ( module && typeof module . runCommand === 'function' ) { const pkgName = pkgJson . name || dirName ; if ( modulesCalled [ pkgName ] ) { logger . verbose ( ` ${ pkgName } ` ) ; } else { logger . verbose ( ` ${ pkgName } ` ) ; modulesCalled [ pkgName ] = true ; if ( module . runCommand ( command , argv ) ) { modulesAnswered . push ( pkgName ) ; } } } } ) ; return modulesAnswered ; }
Iterates over the given modules.
@param {string} command
@param {Object} argv
@param {Array} globs
@returns {Array} modulesAnswered
Iterates over the given modules .