1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | const command_1 = require("./command");
|
7 | const get_stdin_1 = __importDefault(require("get-stdin"));
|
8 | const meow_1 = __importDefault(require("meow"));
|
9 | const help = `
|
10 | Usage
|
11 | $ markuplint <HTML file pathes (glob format)>
|
12 | $ <stdout> | markuplint
|
13 |
|
14 | Options
|
15 | --config-file, -c FILE_PATH Ruleset file path.
|
16 | --fix, Fix HTML.
|
17 | --format, -f FORMAT Output format. Support "JSON", "Simple" and "Standard". Default: "Standard".
|
18 | --no-color, Output no color.
|
19 | --problem-only, -p Output only problems, without passeds.
|
20 |
|
21 | --help, -h Show help.
|
22 | --version, -v Show version.
|
23 |
|
24 | Examples
|
25 | $ markuplint verifyee.html --ruleset path/to/.markuplintrc
|
26 | $ cat verifyee.html | markuplint
|
27 | `;
|
28 | const cli = meow_1.default(help, {
|
29 | flags: {
|
30 | configFile: {
|
31 | type: 'string',
|
32 | alias: 'c',
|
33 | },
|
34 | fix: {
|
35 | type: 'boolean',
|
36 | },
|
37 | format: {
|
38 | type: 'string',
|
39 | alias: 'f',
|
40 | },
|
41 | color: {
|
42 | type: 'boolean',
|
43 | default: true,
|
44 | },
|
45 | problemOnly: {
|
46 | type: 'boolean',
|
47 | alias: 'p',
|
48 | },
|
49 | },
|
50 | });
|
51 | if (cli.flags.v) {
|
52 | cli.showVersion();
|
53 | }
|
54 | if (cli.flags.h) {
|
55 | cli.showHelp();
|
56 | }
|
57 | if (cli.input.length) {
|
58 | command_1.command(Object.assign({ files: cli.input }, cli.flags));
|
59 | }
|
60 | get_stdin_1.default().then(stdin => {
|
61 | const html = stdin;
|
62 | if (!html) {
|
63 | return;
|
64 | }
|
65 | command_1.command(Object.assign({ codes: html }, cli.flags));
|
66 | });
|