@bablr/cli 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/bin/index.js +20 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,13 +10,13 @@ This package has no built-in language support, but rather expects you to supply
|
|
|
10
10
|
Usage: bablr [options]
|
|
11
11
|
|
|
12
12
|
Options:
|
|
13
|
-
-l, --language [URL] The URL of the BABLR language
|
|
14
|
-
-p, --production [type] The
|
|
15
|
-
-f, --format Pretty-format CSTML output
|
|
16
|
-
-F, --no-format
|
|
13
|
+
-l, --language [URL] The URL of the top BABLR language
|
|
14
|
+
-p, --production [type] The name of the top production type
|
|
15
|
+
-f, --format Pretty-format CSTML output (default: true)
|
|
16
|
+
-F, --no-format
|
|
17
17
|
-v, --verbose Prints debugging information to stderr
|
|
18
|
-
-c, --color
|
|
19
|
-
|
|
18
|
+
-c, --color [WHEN] When to use ANSI escape colors
|
|
19
|
+
WHEN: "auto" | "always" | "never" (default: "auto")
|
|
20
20
|
-e, --embedded Requires quoted input but enables gap parsing
|
|
21
21
|
-h, --help display help for command
|
|
22
22
|
```
|
package/bin/index.js
CHANGED
|
@@ -15,18 +15,31 @@ import { generateCSTML } from '../lib/syntax.js';
|
|
|
15
15
|
import { writeLinesToWritableStream } from '../lib/utils/node.js';
|
|
16
16
|
|
|
17
17
|
program
|
|
18
|
-
.option('-l, --language [URL]', 'The URL of the BABLR language
|
|
19
|
-
.option('-p, --production [type]', 'The
|
|
20
|
-
.option('-
|
|
21
|
-
.option('-
|
|
18
|
+
.option('-l, --language [URL]', 'The URL of the top BABLR language')
|
|
19
|
+
.option('-p, --production [type]', 'The name of the top production type')
|
|
20
|
+
.option('-f, --format', 'Pretty-format CSTML output', true)
|
|
21
|
+
.option('-F, --no-format')
|
|
22
22
|
.option('-v, --verbose', 'Prints debugging information to stderr')
|
|
23
|
-
.option(
|
|
24
|
-
|
|
23
|
+
.option(
|
|
24
|
+
'-c, --color [WHEN]',
|
|
25
|
+
'When to use ANSI escape colors \n WHEN: "auto" | "always" | "never"',
|
|
26
|
+
'auto',
|
|
27
|
+
)
|
|
25
28
|
.option('-e, --embedded', 'Requires quoted input but enables gap parsing')
|
|
26
29
|
.parse(process.argv);
|
|
27
30
|
|
|
28
31
|
const programOpts = program.opts();
|
|
29
|
-
|
|
32
|
+
|
|
33
|
+
if (programOpts.color && !['auto', 'always', 'never'].includes(programOpts.color.toLowerCase())) {
|
|
34
|
+
throw new Error('invalid value for --color');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const options = {
|
|
38
|
+
...programOpts,
|
|
39
|
+
color:
|
|
40
|
+
(programOpts.color.toLowerCase() === 'auto' && colorSupport.hasBasic) ||
|
|
41
|
+
programOpts.color.toLowerCase() === 'always',
|
|
42
|
+
};
|
|
30
43
|
|
|
31
44
|
const language = await import(options.language);
|
|
32
45
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bablr/cli",
|
|
3
3
|
"description": "CLI for running BABLR parsers",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.10",
|
|
5
5
|
"author": "Conrad Buck<conartist6@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@bablr/boot": "0.2.3",
|
|
24
24
|
"@bablr/coroutine": "0.1.0",
|
|
25
25
|
"@bablr/helpers": "0.15.4",
|
|
26
|
-
"@bablr/language-cstml": "0.2.
|
|
26
|
+
"@bablr/language-cstml": "0.2.4",
|
|
27
27
|
"bablr": "0.1.3",
|
|
28
28
|
"color-support": "1.1.3",
|
|
29
29
|
"commander": "12.0.0"
|