diff --git a/cli.js b/cli.js index 87754a3..a6e524a 100755 --- a/cli.js +++ b/cli.js @@ -85,12 +85,13 @@ notifier({ var cli = meow({ 'help': [ - 'Usage: alex [ | ...] [-w, --why] [-t, --text]', + 'Usage: alex [ | ...] [-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', @@ -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(',') + '}' @@ -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); }); diff --git a/package.json b/package.json index 029383f..12c9ae8 100644 --- a/package.json +++ b/package.json @@ -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",