Skip to content

Commit

Permalink
Show ignored modules in the table
Browse files Browse the repository at this point in the history
  • Loading branch information
eush77 committed Jul 24, 2015
1 parent 32f08a4 commit 8daf315
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,21 @@ var renderNameTable = function (names) {
return '';
}

var types = {
failed: {
color: 'red',
message: 'failed to load'
},
ignored: {
color: 'yellow',
message: 'ignored'
}
};

table.forEach(function (row) {
if (!row[1]) {
row[1] = chalk.red('(failed to load)');
if (typeof row[1] == 'object') {
var type = types[row[1].type];
row[1] = chalk[type.color]('(' + type.message + ')');
}
});

Expand All @@ -89,13 +101,18 @@ var renderNameTable = function (names) {
: Path.basename(findRoot(path)); // node_modules/module/src/index.js
};

(typeof opts.ignore == 'string' ? [opts.ignore] : opts.ignore || [])
.forEach(function (name) {
names[name] = { type: 'ignored' };
});

replHere(repl, process.cwd(), opts)
.on('load', function (name, path) {
names[packageName(path)] = name;
})
.on('fail', function (name, path) {
if (opts.verbose) {
names[packageName(path)] = false;
names[packageName(path)] = { type: 'failed' };
}
else {
console.error('\rModule failed to load: ' + name);
Expand Down

0 comments on commit 8daf315

Please sign in to comment.