Skip to content

Commit

Permalink
Add support for -q, --quiet
Browse files Browse the repository at this point in the history
Closes GH-99.
  • Loading branch information
wooorm committed Jun 23, 2016
1 parent 98e7277 commit 7d0b961
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ notifier({

var cli = meow({
'help': [
'Usage: alex [<file> | <dir> ...] [-w, --why] [-t, --text]',
'Usage: alex [<file> | <dir> ...] [-q, --quiet] [-w, --why] ' +
'[-t, --text]',
'',
'Options:',
'',
' -w, --why output more info regarding why things might be ' +
'offensive',
' -w, --why output sources (when available)',
' -q, --quiet output only warnings and errors',
' -t, --text treat input as plain-text (not markdown)',
'',
'When no input files are given, searches for markdown and text',
Expand All @@ -110,6 +111,7 @@ var cli = meow({
var exit = 0;
var result = [];
var why = Boolean(cli.flags.w || cli.flags.why);
var quiet = Boolean(cli.flags.q || cli.flags.quiet);
var fn = (cli.flags.t || cli.flags.text) ? 'text' : 'markdown';
var globs = cli.input.length ? cli.input : [
'{docs/**/,doc/**/,}*.{' + extensions.join(',') + '}'
Expand All @@ -120,9 +122,14 @@ var globs = cli.input.length ? cli.input : [
*/

process.on('exit', function () {
console.log(format(result, {
'verbose': why
}));
var report = format(result, {
'verbose': why,
'quiet': quiet
});

if (report) {
console.log(report);
}

process.exit(exit);
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"lint-api": "eslint .",
"lint-style": "jscs --reporter inline .",
"lint-text": "./cli.js . --why",
"lint-text": "./cli.js . --why --quiet",
"lint": "npm run lint-api && npm run lint-style && npm run lint-text",
"test-api": "ava",
"test-coverage": "nyc ava",
Expand Down

0 comments on commit 7d0b961

Please sign in to comment.