UNPKG

1.59 kBJavaScriptView Raw
1#!/usr/bin/env node
2
3var program = require('commander');
4var cli = require('../lib/cli-reporter');
5var pkg = require('../package.json');
6
7function list(val) {
8 return val.split(',');
9}
10
11program
12 .description('Report todos and fixmes from json files or stream')
13 .version(pkg.version)
14 .usage('[options] <file ...>')
15 .option('-i, --ignore <patterns>', 'add ignore patterns', list, [])
16 .option('-r, --reporter [reporter]', 'use reporter (table|json|xml|markdown|vscode|raw) (default: table)', 'table')
17 .option('-x, --exit-nicely', 'exit with exit code 0 even if todos/fixmes are found', false)
18 .on('--help', function () {
19 console.log(' Examples:');
20 console.log('');
21 console.log(' # Report todos from a specific file');
22 console.log(' $ leasot-reporter index.json');
23 console.log('');
24 console.log(' # Report todos from a glob pattern');
25 console.log(' $ leasot-reporter **/*.json');
26 console.log('');
27 console.log(' # Use the json reporter');
28 console.log(' $ leasot-reporter --reporter json index.json');
29 console.log('');
30 console.log(' # Report from a json stream');
31 console.log(' $ cat index.json | leasot-reporter --reporter xml');
32 console.log('');
33 console.log(' # Report from leasot parsing and filter todos using `jq`');
34 console.log(' $ leasot tests/**/*.styl --reporter json | jq \'map(select(.kind == "TODO"))\' | leasot-reporter');
35 console.log('');
36 })
37 .parse(process.argv);
38
39cli(program);