Skip to content
This repository has been archived by the owner on May 8, 2018. It is now read-only.

Commit

Permalink
Merge pull request #178 from nodesecurity/quiet-flag
Browse files Browse the repository at this point in the history
Add quiet output
  • Loading branch information
nlf committed Jul 26, 2017
2 parents 5ee23ec + cf32c95 commit 11d5635
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/commands/check.js
@@ -1,7 +1,6 @@
'use strict';
var usage = require('../../lib/utils/usage.js')('check.txt');
var Check = require('../check.js');
var Formatters = require('../formatters');
var Path = require('path');
var getFormatter = require('../../lib/index').getFormatter;

Expand Down Expand Up @@ -53,6 +52,11 @@ module.exports = {
name: 'warn-only',
boolean: true,
default: false
},
{
name: 'quiet',
boolean: true,
default: false
}
],
command: onCommand
Expand Down
1 change: 1 addition & 0 deletions lib/formatters/index.js
Expand Up @@ -5,5 +5,6 @@ module.exports = {
default: require('./default'),
summary: require('./summary'),
json: require('./json'),
quiet: require('./quiet'),
none: require('./none')
};
26 changes: 26 additions & 0 deletions lib/formatters/quiet.js
@@ -0,0 +1,26 @@
'use strict';

var Chalk = require('chalk');

module.exports = function (err, data, pkgPath) {

var returnString = '';

if (err) {
if (data) {
returnString += Chalk.red('(+) ') + 'Debug output: ' + JSON.stringify(Buffer.isBuffer(data) ? data.toString() : data) + '\n';
}

return returnString + Chalk.yellow('(+) ') + err;
}

if (data.length === 0) {

return '';
}

returnString += Chalk.red('(+) ') + data.length + ' vulnerabilities found\n';


return returnString;
};
1 change: 1 addition & 0 deletions lib/index.js
Expand Up @@ -3,6 +3,7 @@
var Formatters = require('./formatters');

var getFormatter = function (name) {

if (Object.keys(Formatters).indexOf(name) !== -1) {
return Formatters[name];
}
Expand Down
1 change: 1 addition & 0 deletions usage/check.txt
Expand Up @@ -11,6 +11,7 @@ Parameters
summary
json
codeclimate
quiet
none (does what you think it does)

--offline: optional
Expand Down

0 comments on commit 11d5635

Please sign in to comment.