1 | const meow = require('meow');
|
2 | const pkg = require('../package');
|
3 |
|
4 | const help = require('./help');
|
5 | const unknown = require('./unknown');
|
6 |
|
7 | const configuration = {
|
8 |
|
9 | string: ['ignore', 'validate', 'indent', 'env'],
|
10 |
|
11 | boolean: ['pretty', 'sort', 'help', 'version'],
|
12 |
|
13 | alias: {
|
14 | i: 'ignore',
|
15 | s: 'validate',
|
16 | t: 'sort',
|
17 | w: 'indent',
|
18 | e: 'env',
|
19 | p: 'pretty',
|
20 | h: 'help',
|
21 | v: 'version'
|
22 | },
|
23 | description: {
|
24 | ignore: 'glob pattern to exclude from linting',
|
25 | validate: 'uri to schema to use for validation',
|
26 | indent: 'whitespace to use for pretty printing',
|
27 | env: 'json schema env to use for validation',
|
28 | pretty: 'pretty-print the input',
|
29 | sort: 'sort json keys alphabetically',
|
30 | version: 'print the version',
|
31 | help: 'show this help'
|
32 | },
|
33 |
|
34 | default: {
|
35 | ignore: ['node_modules'],
|
36 | validate: '',
|
37 | indent: '" "',
|
38 | env: 'json-schema-draft-04',
|
39 | quiet: true,
|
40 | pretty: false,
|
41 | sort: false
|
42 | },
|
43 | unknown: unknown
|
44 | };
|
45 |
|
46 | module.exports = meow({
|
47 | help: `[input] reads from stdin if [files] are omitted\n${help(configuration)}`,
|
48 | description: `${pkg.name}@${pkg.version} - ${pkg.description}`
|
49 | }, configuration);
|