-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
43 lines (40 loc) · 1.02 KB
/
Copy pathindex.js
File metadata and controls
43 lines (40 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env node
/* eslint strict: "off" */
'use strict';
const cli = require( './src/cli' );
const optionator = require( 'optionator' )( {
options: [ {
option: 'processors',
alias: 'p',
type: 'String',
description: 'choose a list of processors - "downgrade-unmodified-lines" by default',
}, {
option: 'format',
alias: 'f',
type: 'String',
description: 'choose an ESLint output format for eslines - "stylish" by default',
}, {
option: 'diff',
alias: 'd',
type: 'String',
description: 'choose what to diff, index or remote - "remote" by default',
}, {
option: 'quiet',
alias: 'q',
type: 'Boolean',
description: 'report errors only',
} ],
} );
if ( ! process.stdin.isTTY ) {
process.stdin.setEncoding( 'utf-8' );
let inputData = '';
process.stdin.on( 'data', function( data ) {
inputData = inputData + data;
} );
process.stdin.on( 'end', () => {
const opts = optionator.parseArgv( process.argv );
cli( JSON.parse( inputData ), opts ).then( rc => {
process.exitCode = rc;
} );
} );
}