@optique/core 0.5.0-dev.82 → 0.5.0
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/dist/facade.cjs +4 -22
- package/dist/facade.js +4 -22
- package/package.json +1 -1
package/dist/facade.cjs
CHANGED
|
@@ -14,30 +14,18 @@ const require_parser = require('./parser.cjs');
|
|
|
14
14
|
function createHelpParser(mode) {
|
|
15
15
|
const helpCommand = require_primitives.command("help", require_modifiers.multiple(require_primitives.argument(require_valueparser.string({ metavar: "COMMAND" }))), { description: require_message.message`Show help information.` });
|
|
16
16
|
const helpOption = require_primitives.flag("--help", { description: require_message.message`Show help information.` });
|
|
17
|
-
const _contextualHelpParser = require_constructs.object({
|
|
18
|
-
help: require_primitives.constant(true),
|
|
19
|
-
version: require_primitives.constant(false),
|
|
20
|
-
commands: require_modifiers.multiple(require_primitives.argument(require_valueparser.string({
|
|
21
|
-
metavar: "COMMAND",
|
|
22
|
-
pattern: /^[^-].*$/
|
|
23
|
-
}))),
|
|
24
|
-
__help: require_primitives.flag("--help")
|
|
25
|
-
});
|
|
26
17
|
switch (mode) {
|
|
27
18
|
case "command": return {
|
|
28
19
|
helpCommand,
|
|
29
|
-
helpOption: null
|
|
30
|
-
contextualHelpParser: null
|
|
20
|
+
helpOption: null
|
|
31
21
|
};
|
|
32
22
|
case "option": return {
|
|
33
23
|
helpCommand: null,
|
|
34
|
-
helpOption
|
|
35
|
-
contextualHelpParser: null
|
|
24
|
+
helpOption
|
|
36
25
|
};
|
|
37
26
|
case "both": return {
|
|
38
27
|
helpCommand,
|
|
39
|
-
helpOption
|
|
40
|
-
contextualHelpParser: null
|
|
28
|
+
helpOption
|
|
41
29
|
};
|
|
42
30
|
}
|
|
43
31
|
}
|
|
@@ -83,14 +71,12 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers) {
|
|
|
83
71
|
};
|
|
84
72
|
let helpFound = false;
|
|
85
73
|
let helpIndex = -1;
|
|
86
|
-
let helpCount = 0;
|
|
87
74
|
let versionIndex = -1;
|
|
88
75
|
for (let i = 0; i < buffer.length; i++) {
|
|
89
76
|
if (buffer[i] === "--") break;
|
|
90
77
|
if (buffer[i] === "--help") {
|
|
91
78
|
helpFound = true;
|
|
92
79
|
helpIndex = i;
|
|
93
|
-
helpCount++;
|
|
94
80
|
}
|
|
95
81
|
if (buffer[i] === "--version") versionIndex = i;
|
|
96
82
|
}
|
|
@@ -154,14 +140,12 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers) {
|
|
|
154
140
|
};
|
|
155
141
|
let versionFound = false;
|
|
156
142
|
let versionIndex = -1;
|
|
157
|
-
let versionCount = 0;
|
|
158
143
|
let helpIndex = -1;
|
|
159
144
|
for (let i = 0; i < buffer.length; i++) {
|
|
160
145
|
if (buffer[i] === "--") break;
|
|
161
146
|
if (buffer[i] === "--version") {
|
|
162
147
|
versionFound = true;
|
|
163
148
|
versionIndex = i;
|
|
164
|
-
versionCount++;
|
|
165
149
|
}
|
|
166
150
|
if (buffer[i] === "--help") helpIndex = i;
|
|
167
151
|
}
|
|
@@ -212,7 +196,6 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers) {
|
|
|
212
196
|
version: require_primitives.constant(false),
|
|
213
197
|
commands: helpParsers.helpCommand
|
|
214
198
|
}));
|
|
215
|
-
if (helpParsers.contextualHelpParser) parsers.push(helpParsers.contextualHelpParser);
|
|
216
199
|
parsers.push(require_constructs.object({
|
|
217
200
|
help: require_primitives.constant(false),
|
|
218
201
|
version: require_primitives.constant(false),
|
|
@@ -304,8 +287,7 @@ function run(parser, programName, args, options = {}) {
|
|
|
304
287
|
const version = options.version ? versionMode : "none";
|
|
305
288
|
const helpParsers = help === "none" ? {
|
|
306
289
|
helpCommand: null,
|
|
307
|
-
helpOption: null
|
|
308
|
-
contextualHelpParser: null
|
|
290
|
+
helpOption: null
|
|
309
291
|
} : createHelpParser(help);
|
|
310
292
|
const versionParsers = version === "none" ? {
|
|
311
293
|
versionCommand: null,
|
package/dist/facade.js
CHANGED
|
@@ -14,30 +14,18 @@ import { getDocPage, parse } from "./parser.js";
|
|
|
14
14
|
function createHelpParser(mode) {
|
|
15
15
|
const helpCommand = command("help", multiple(argument(string({ metavar: "COMMAND" }))), { description: message`Show help information.` });
|
|
16
16
|
const helpOption = flag("--help", { description: message`Show help information.` });
|
|
17
|
-
const _contextualHelpParser = object({
|
|
18
|
-
help: constant(true),
|
|
19
|
-
version: constant(false),
|
|
20
|
-
commands: multiple(argument(string({
|
|
21
|
-
metavar: "COMMAND",
|
|
22
|
-
pattern: /^[^-].*$/
|
|
23
|
-
}))),
|
|
24
|
-
__help: flag("--help")
|
|
25
|
-
});
|
|
26
17
|
switch (mode) {
|
|
27
18
|
case "command": return {
|
|
28
19
|
helpCommand,
|
|
29
|
-
helpOption: null
|
|
30
|
-
contextualHelpParser: null
|
|
20
|
+
helpOption: null
|
|
31
21
|
};
|
|
32
22
|
case "option": return {
|
|
33
23
|
helpCommand: null,
|
|
34
|
-
helpOption
|
|
35
|
-
contextualHelpParser: null
|
|
24
|
+
helpOption
|
|
36
25
|
};
|
|
37
26
|
case "both": return {
|
|
38
27
|
helpCommand,
|
|
39
|
-
helpOption
|
|
40
|
-
contextualHelpParser: null
|
|
28
|
+
helpOption
|
|
41
29
|
};
|
|
42
30
|
}
|
|
43
31
|
}
|
|
@@ -83,14 +71,12 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers) {
|
|
|
83
71
|
};
|
|
84
72
|
let helpFound = false;
|
|
85
73
|
let helpIndex = -1;
|
|
86
|
-
let helpCount = 0;
|
|
87
74
|
let versionIndex = -1;
|
|
88
75
|
for (let i = 0; i < buffer.length; i++) {
|
|
89
76
|
if (buffer[i] === "--") break;
|
|
90
77
|
if (buffer[i] === "--help") {
|
|
91
78
|
helpFound = true;
|
|
92
79
|
helpIndex = i;
|
|
93
|
-
helpCount++;
|
|
94
80
|
}
|
|
95
81
|
if (buffer[i] === "--version") versionIndex = i;
|
|
96
82
|
}
|
|
@@ -154,14 +140,12 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers) {
|
|
|
154
140
|
};
|
|
155
141
|
let versionFound = false;
|
|
156
142
|
let versionIndex = -1;
|
|
157
|
-
let versionCount = 0;
|
|
158
143
|
let helpIndex = -1;
|
|
159
144
|
for (let i = 0; i < buffer.length; i++) {
|
|
160
145
|
if (buffer[i] === "--") break;
|
|
161
146
|
if (buffer[i] === "--version") {
|
|
162
147
|
versionFound = true;
|
|
163
148
|
versionIndex = i;
|
|
164
|
-
versionCount++;
|
|
165
149
|
}
|
|
166
150
|
if (buffer[i] === "--help") helpIndex = i;
|
|
167
151
|
}
|
|
@@ -212,7 +196,6 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers) {
|
|
|
212
196
|
version: constant(false),
|
|
213
197
|
commands: helpParsers.helpCommand
|
|
214
198
|
}));
|
|
215
|
-
if (helpParsers.contextualHelpParser) parsers.push(helpParsers.contextualHelpParser);
|
|
216
199
|
parsers.push(object({
|
|
217
200
|
help: constant(false),
|
|
218
201
|
version: constant(false),
|
|
@@ -304,8 +287,7 @@ function run(parser, programName, args, options = {}) {
|
|
|
304
287
|
const version = options.version ? versionMode : "none";
|
|
305
288
|
const helpParsers = help === "none" ? {
|
|
306
289
|
helpCommand: null,
|
|
307
|
-
helpOption: null
|
|
308
|
-
contextualHelpParser: null
|
|
290
|
+
helpOption: null
|
|
309
291
|
} : createHelpParser(help);
|
|
310
292
|
const versionParsers = version === "none" ? {
|
|
311
293
|
versionCommand: null,
|