@optique/core 1.0.0-dev.1461 → 1.0.0-dev.1463
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/parser.cjs +3 -3
- package/dist/parser.js +3 -3
- package/dist/usage.cjs +14 -1
- package/dist/usage.js +14 -1
- package/package.json +1 -1
package/dist/parser.cjs
CHANGED
|
@@ -414,12 +414,12 @@ function buildDocPage(parser, context, args) {
|
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
416
|
const sections = buildingSections;
|
|
417
|
-
const usage = require_usage.
|
|
417
|
+
const usage = [...require_usage.normalizeUsage(parser.usage)];
|
|
418
418
|
const maybeApplyCommandUsageLine = (term, arg, isLastArg, usageIndex) => {
|
|
419
419
|
if (term?.type !== "command" || term.name !== arg || !isLastArg || term.usageLine == null) return;
|
|
420
420
|
const defaultUsageLine = require_usage.cloneUsage(usage.slice(usageIndex + 1));
|
|
421
421
|
const customUsageLine = typeof term.usageLine === "function" ? term.usageLine(defaultUsageLine) : term.usageLine;
|
|
422
|
-
const normalizedCustomUsageLine = require_usage.
|
|
422
|
+
const normalizedCustomUsageLine = require_usage.normalizeUsage(customUsageLine);
|
|
423
423
|
usage.splice(usageIndex + 1, usage.length - (usageIndex + 1), ...normalizedCustomUsageLine);
|
|
424
424
|
};
|
|
425
425
|
let i = 0;
|
|
@@ -442,7 +442,7 @@ function buildDocPage(parser, context, args) {
|
|
|
442
442
|
if (first.type === "command" && first.usageLine != null) {
|
|
443
443
|
const defaultUsageLine = require_usage.cloneUsage(usage.slice(1));
|
|
444
444
|
const customUsageLine = typeof first.usageLine === "function" ? first.usageLine(defaultUsageLine) : first.usageLine;
|
|
445
|
-
const normalizedCustomUsageLine = require_usage.
|
|
445
|
+
const normalizedCustomUsageLine = require_usage.normalizeUsage(customUsageLine);
|
|
446
446
|
usage.splice(1, usage.length - 1, ...normalizedCustomUsageLine);
|
|
447
447
|
}
|
|
448
448
|
}
|
package/dist/parser.js
CHANGED
|
@@ -414,12 +414,12 @@ function buildDocPage(parser, context, args) {
|
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
416
|
const sections = buildingSections;
|
|
417
|
-
const usage =
|
|
417
|
+
const usage = [...normalizeUsage(parser.usage)];
|
|
418
418
|
const maybeApplyCommandUsageLine = (term, arg, isLastArg, usageIndex) => {
|
|
419
419
|
if (term?.type !== "command" || term.name !== arg || !isLastArg || term.usageLine == null) return;
|
|
420
420
|
const defaultUsageLine = cloneUsage(usage.slice(usageIndex + 1));
|
|
421
421
|
const customUsageLine = typeof term.usageLine === "function" ? term.usageLine(defaultUsageLine) : term.usageLine;
|
|
422
|
-
const normalizedCustomUsageLine =
|
|
422
|
+
const normalizedCustomUsageLine = normalizeUsage(customUsageLine);
|
|
423
423
|
usage.splice(usageIndex + 1, usage.length - (usageIndex + 1), ...normalizedCustomUsageLine);
|
|
424
424
|
};
|
|
425
425
|
let i = 0;
|
|
@@ -442,7 +442,7 @@ function buildDocPage(parser, context, args) {
|
|
|
442
442
|
if (first.type === "command" && first.usageLine != null) {
|
|
443
443
|
const defaultUsageLine = cloneUsage(usage.slice(1));
|
|
444
444
|
const customUsageLine = typeof first.usageLine === "function" ? first.usageLine(defaultUsageLine) : first.usageLine;
|
|
445
|
-
const normalizedCustomUsageLine =
|
|
445
|
+
const normalizedCustomUsageLine = normalizeUsage(customUsageLine);
|
|
446
446
|
usage.splice(1, usage.length - 1, ...normalizedCustomUsageLine);
|
|
447
447
|
}
|
|
448
448
|
}
|
package/dist/usage.cjs
CHANGED
|
@@ -246,7 +246,20 @@ function normalizeUsageTerm(term) {
|
|
|
246
246
|
type: "exclusive",
|
|
247
247
|
terms
|
|
248
248
|
};
|
|
249
|
-
} else
|
|
249
|
+
} else {
|
|
250
|
+
if (term.type === "option") return {
|
|
251
|
+
...term,
|
|
252
|
+
names: [...term.names]
|
|
253
|
+
};
|
|
254
|
+
else if (term.type === "command") {
|
|
255
|
+
if (term.usageLine == null || typeof term.usageLine === "function") return { ...term };
|
|
256
|
+
return {
|
|
257
|
+
...term,
|
|
258
|
+
usageLine: cloneUsage(term.usageLine)
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
return { ...term };
|
|
262
|
+
}
|
|
250
263
|
}
|
|
251
264
|
function isNonDegenerateTerm(term) {
|
|
252
265
|
if (term.type === "option") return term.names.length > 0;
|
package/dist/usage.js
CHANGED
|
@@ -245,7 +245,20 @@ function normalizeUsageTerm(term) {
|
|
|
245
245
|
type: "exclusive",
|
|
246
246
|
terms
|
|
247
247
|
};
|
|
248
|
-
} else
|
|
248
|
+
} else {
|
|
249
|
+
if (term.type === "option") return {
|
|
250
|
+
...term,
|
|
251
|
+
names: [...term.names]
|
|
252
|
+
};
|
|
253
|
+
else if (term.type === "command") {
|
|
254
|
+
if (term.usageLine == null || typeof term.usageLine === "function") return { ...term };
|
|
255
|
+
return {
|
|
256
|
+
...term,
|
|
257
|
+
usageLine: cloneUsage(term.usageLine)
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
return { ...term };
|
|
261
|
+
}
|
|
249
262
|
}
|
|
250
263
|
function isNonDegenerateTerm(term) {
|
|
251
264
|
if (term.type === "option") return term.names.length > 0;
|