-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
executable file
·34 lines (28 loc) · 979 Bytes
/
cli.js
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
#!/usr/bin/env node
const { program } = require('commander');
const markdownLint = require('.');
const { prepareExtensions } = require('./lib/utils');
const { version, description } = require('./package.json');
program
.option('--fix', 'Automatically fix problems')
.option('--ext <value>', 'Specify file extensions', prepareExtensions, ['md', 'MD'])
.option('-t, --typograph', 'Enable typograph')
.option('-r, --recursive', 'Get files from provided directory and the entire subtree')
.option('-c, --config <file>', 'Use this configuration, overriding default options if present');
program
.usage('[options] <dir> <file ...>')
.version(version, '-v, --version')
.description(description)
.parse(process.argv);
if (!program.args.length) {
program.help();
} else {
markdownLint({
paths: program.args,
fix: program.fix,
ext: program.ext,
recursive: program.recursive,
config: program.config,
typograph: program.typograph,
});
}