1 | #!/usr/bin/env node
|
2 | var cli = require('../lib/get-cli');
|
3 |
|
4 | /**
|
5 | * Command line implementation for JSCS.
|
6 | *
|
7 | * Common usage case is:
|
8 | *
|
9 | * ./node_modules/.bin/jscs file1 dir1 file2 dir2
|
10 | */
|
11 | var program = require('commander');
|
12 |
|
13 | program
|
14 | .version(require('../package.json').version)
|
15 | .usage('[options] <file ...>')
|
16 | .description('A code style linter for programmatically enforcing your style guide.')
|
17 | .option('-c, --config [path]', 'configuration file path')
|
18 | .option('--auto-configure <path> [paths]', 'auto-generate a JSCS configuration file')
|
19 | .option('-x, --fix', 'fix code style violations (applies to fixable violations)')
|
20 | .option('--extract <mask>', 'set file masks from which to extract JavaScript', function(value, memo) {
|
21 | return memo ? memo.concat(value) : [value];
|
22 | })
|
23 | .option('--es3', 'validates code as es3')
|
24 | .option('-n, --no-colors', 'clean output without colors')
|
25 | .option('-p, --preset <preset>', 'preset config')
|
26 | .option('-m, --max-errors <number>', 'maximum number of errors to report')
|
27 | .option('-f, --error-filter <path>', 'a module to filter errors')
|
28 | .option('-r, --reporter <reporter>',
|
29 | 'error reporter, console - default, text, checkstyle, junit, inline, unix, summary, json')
|
30 | .option('', 'Also accepts relative or absolute path to custom reporter')
|
31 | .option('', 'For instance:')
|
32 | .option('', '\t ../some-dir/my-reporter.js\t(relative path with extension)')
|
33 | .option('', '\t ../some-dir/my-reporter\t(relative path without extension)')
|
34 | .option('', '\t /path/to/my-reporter.js\t(absolute path with extension)')
|
35 | .option('', '\t /path/to/my-reporter\t\t(absolute path without extension)')
|
36 | .parse(process.argv);
|
37 |
|
38 | cli(program);
|