UNPKG

1.78 kBJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6const command_1 = require("./command");
7const get_stdin_1 = __importDefault(require("get-stdin"));
8const meow_1 = __importDefault(require("meow"));
9const help = `
10Usage
11 $ markuplint <HTML file pathes (glob format)>
12 $ <stdout> | markuplint
13
14Options
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
24Examples
25 $ markuplint verifyee.html --ruleset path/to/.markuplintrc
26 $ cat verifyee.html | markuplint
27`;
28const 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});
51if (cli.flags.v) {
52 cli.showVersion();
53}
54if (cli.flags.h) {
55 cli.showHelp();
56}
57if (cli.input.length) {
58 command_1.command(Object.assign({ files: cli.input }, cli.flags));
59}
60get_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});