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

Commit

Permalink
add quiet output
Browse files Browse the repository at this point in the history
  • Loading branch information
Bentley authored and Bentley committed Jul 25, 2017
1 parent c20afb3 commit 215432f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/commands/check.js
Expand Up @@ -53,7 +53,12 @@ module.exports = {
name: 'warn-only',
boolean: true,
default: false
}
},
{
name: 'quiet',
boolean: true,
default: false
}
],
command: onCommand
};
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')
};
36 changes: 36 additions & 0 deletions lib/formatters/quiet.js
@@ -0,0 +1,36 @@
'use strict';

var Chalk = require('chalk');
var Table = require('cli-table');
var Cvss = require('cvss');

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;
}

var width = 80;
var colWidth = 15;
if (process.stdout.isTTY) {
width = process.stdout.getWindowSize()[0] - 10;
if (!width || width <= colWidth) {
width = 80;
}
}
if (data.length === 0) {

return '';
}

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


return returnString;
};

0 comments on commit 215432f

Please sign in to comment.