{"size": 1190, "ext": "js", "max_stars_repo_path": "cli.js", "max_stars_repo_name": "makotot/-depen", "max_stars_repo_stars_event_min_datetime": "2015-05-29T18:24:42.000Z", "max_stars_repo_stars_event_max_datetime": "2015-06-28T22:59:01.000Z", "max_issues_repo_path": "cli.js", "max_issues_repo_name": "makotot/-depen", "max_issues_repo_issues_event_min_datetime": "2015-05-30T00:46:23.000Z", "max_issues_repo_issues_event_max_datetime": "2015-06-02T15:38:04.000Z", "max_forks_repo_path": "cli.js", "max_forks_repo_name": "makotot/-depen", "max_forks_repo_forks_event_min_datetime": "2015-05-29T18:32:59.000Z", "max_forks_repo_forks_event_max_datetime": "2015-05-29T18:32:59.000Z"}
{"max_stars_count": 10, "max_issues_count": 7, "max_forks_count": 1, "avg_line_length": 24.7916666667, "max_line_length": 169, "alphanum_fraction": 0.5789915966}
#!/usr/bin/env node

var fs = require('fs'),
  meow = require('meow'),
  chalk = require('chalk'),
  figures = require('figures'),
  depen = require('./');

var cli = meow({
  help: [
    'Usage',
    ' $ depen [-r] [project dir]'
  ].join('\n')
});


function printDeps (root, indent, shiftwidth) {

  depen(root, function (err, dependencies) {
    if (err) {
      throw err;
    }

    dependencies.dependency.forEach(function (dep) {
      var offset = Array(shiftwidth).join(' ');

      console.log(offset + figures.pointer, chalk.white.underline(dep.type));

      dep.package.forEach(function (package) {
        console.log(offset + indent, chalk.blue(package.name), chalk.yellow(package.version));
        console.log(offset + indent + indent, chalk.gray(package.description ? package.description : '---'), chalk.magenta(package.homepage ? package.homepage : '---'));

        if (cli.flags['r']) {
          var innerpath = root + '/node_modules/' + package.name;
          if (fs.existsSync(innerpath)) {
            printDeps(innerpath, indent, shiftwidth + 2);
          }
        }

      });
      console.log('');
    });
  });

}

printDeps(cli.input[0] || '.', '  ', 0);
