UNPKG

2.41 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.argParser = void 0;
4const path = require("path");
5const nomnom = require("nomnom");
6exports.argParser = nomnom
7 .script('ecmarkup')
8 .help('Compile ecmarkup documents to html by passing your input file and output file.')
9 .options({
10 help: { abbr: 'h', flag: true, help: 'Display this help message' },
11 watch: { abbr: 'w', flag: true, help: 'Rebuild when files change' },
12 biblio: { abbr: 'b', metavar: 'FILE', help: 'Write a biblio file to FILE' },
13 ecma262Biblio: {
14 full: 'ecma-262-biblio',
15 flag: true,
16 default: true,
17 help: 'Load ECMA-262 biblio file',
18 },
19 assets: { choices: ['none', 'inline', 'external'], help: 'Link to css and js assets' },
20 cssOut: { full: 'css-out', metavar: 'FILE', help: 'Write Emu CSS dependencies to FILE' },
21 jsOut: { full: 'js-out', metavar: 'FILE', help: 'Write Emu JS dependencies to FILE' },
22 toc: { flag: true, help: "Don't include the table of contents" },
23 oldToc: { full: 'old-toc', flag: true, help: 'Use the old table of contents styling' },
24 lintSpec: {
25 full: 'lint-spec',
26 flag: true,
27 default: false,
28 help: 'Enforce some style and correctness checks',
29 },
30 lintFormatter: {
31 full: 'lint-formatter',
32 metavar: 'FORMAT',
33 default: 'codeframe',
34 help: 'The linting output formatter. Either the name of a built-in eslint formatter or the package name of an installed eslint compatible formatter.',
35 },
36 multipage: {
37 flag: true,
38 help: 'Generate a multipage version of the spec. Cannot be used with --js-out or --css-out.',
39 },
40 strict: {
41 flag: true,
42 default: false,
43 help: 'Exit with an error if there are warnings. Cannot be used with --watch.',
44 },
45 verbose: { flag: true, default: false, help: 'Display document build progress' },
46 version: {
47 abbr: 'v',
48 flag: true,
49 help: 'Display version info',
50 callback: printVersion,
51 },
52 infile: {
53 position: 0,
54 help: 'Input ecmarkup file',
55 required: true,
56 },
57 outfile: {
58 position: 1,
59 help: 'Output html or biblio file',
60 },
61});
62function printVersion() {
63 const p = require(path.resolve(__dirname, '..', 'package.json'));
64 return 'ecmarkup v' + p.version;
65}