@optique/core 0.10.0-dev.355 → 0.10.0-dev.359
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/constructs.cjs +9 -0
- package/dist/constructs.js +9 -0
- package/dist/doc.d.cts +6 -0
- package/dist/doc.d.ts +6 -0
- package/dist/facade.cjs +6 -4
- package/dist/facade.js +6 -4
- package/dist/parser.cjs +2 -1
- package/dist/parser.js +2 -1
- package/dist/primitives.cjs +1 -0
- package/dist/primitives.js +1 -0
- package/package.json +1 -1
package/dist/constructs.cjs
CHANGED
|
@@ -366,7 +366,9 @@ function or(...args) {
|
|
|
366
366
|
},
|
|
367
367
|
suggest: createExclusiveSuggest(parsers, combinedMode),
|
|
368
368
|
getDocFragments(state, _defaultValue) {
|
|
369
|
+
let brief;
|
|
369
370
|
let description;
|
|
371
|
+
let footer;
|
|
370
372
|
let fragments;
|
|
371
373
|
if (state.kind === "unavailable" || state.state == null) fragments = parsers.flatMap((p) => p.getDocFragments({ kind: "unavailable" }, void 0).fragments);
|
|
372
374
|
else {
|
|
@@ -376,7 +378,9 @@ function or(...args) {
|
|
|
376
378
|
state: parserResult.next.state
|
|
377
379
|
} : { kind: "unavailable" };
|
|
378
380
|
const docFragments = parsers[index].getDocFragments(innerState, void 0);
|
|
381
|
+
brief = docFragments.brief;
|
|
379
382
|
description = docFragments.description;
|
|
383
|
+
footer = docFragments.footer;
|
|
380
384
|
fragments = docFragments.fragments;
|
|
381
385
|
}
|
|
382
386
|
const entries = fragments.filter((f) => f.type === "entry");
|
|
@@ -387,7 +391,9 @@ function or(...args) {
|
|
|
387
391
|
else sections.push(fragment);
|
|
388
392
|
}
|
|
389
393
|
return {
|
|
394
|
+
brief,
|
|
390
395
|
description,
|
|
396
|
+
footer,
|
|
391
397
|
fragments: [...sections.map((s) => ({
|
|
392
398
|
...s,
|
|
393
399
|
type: "section"
|
|
@@ -502,6 +508,7 @@ function longestMatch(...args) {
|
|
|
502
508
|
},
|
|
503
509
|
suggest: createExclusiveSuggest(parsers, combinedMode),
|
|
504
510
|
getDocFragments(state, _defaultValue) {
|
|
511
|
+
let brief;
|
|
505
512
|
let description;
|
|
506
513
|
let footer;
|
|
507
514
|
let fragments;
|
|
@@ -513,12 +520,14 @@ function longestMatch(...args) {
|
|
|
513
520
|
kind: "available",
|
|
514
521
|
state: result.next.state
|
|
515
522
|
});
|
|
523
|
+
brief = docResult.brief;
|
|
516
524
|
description = docResult.description;
|
|
517
525
|
footer = docResult.footer;
|
|
518
526
|
fragments = docResult.fragments;
|
|
519
527
|
} else fragments = parsers.flatMap((p) => p.getDocFragments({ kind: "unavailable" }).fragments);
|
|
520
528
|
}
|
|
521
529
|
return {
|
|
530
|
+
brief,
|
|
522
531
|
description,
|
|
523
532
|
fragments,
|
|
524
533
|
footer
|
package/dist/constructs.js
CHANGED
|
@@ -366,7 +366,9 @@ function or(...args) {
|
|
|
366
366
|
},
|
|
367
367
|
suggest: createExclusiveSuggest(parsers, combinedMode),
|
|
368
368
|
getDocFragments(state, _defaultValue) {
|
|
369
|
+
let brief;
|
|
369
370
|
let description;
|
|
371
|
+
let footer;
|
|
370
372
|
let fragments;
|
|
371
373
|
if (state.kind === "unavailable" || state.state == null) fragments = parsers.flatMap((p) => p.getDocFragments({ kind: "unavailable" }, void 0).fragments);
|
|
372
374
|
else {
|
|
@@ -376,7 +378,9 @@ function or(...args) {
|
|
|
376
378
|
state: parserResult.next.state
|
|
377
379
|
} : { kind: "unavailable" };
|
|
378
380
|
const docFragments = parsers[index].getDocFragments(innerState, void 0);
|
|
381
|
+
brief = docFragments.brief;
|
|
379
382
|
description = docFragments.description;
|
|
383
|
+
footer = docFragments.footer;
|
|
380
384
|
fragments = docFragments.fragments;
|
|
381
385
|
}
|
|
382
386
|
const entries = fragments.filter((f) => f.type === "entry");
|
|
@@ -387,7 +391,9 @@ function or(...args) {
|
|
|
387
391
|
else sections.push(fragment);
|
|
388
392
|
}
|
|
389
393
|
return {
|
|
394
|
+
brief,
|
|
390
395
|
description,
|
|
396
|
+
footer,
|
|
391
397
|
fragments: [...sections.map((s) => ({
|
|
392
398
|
...s,
|
|
393
399
|
type: "section"
|
|
@@ -502,6 +508,7 @@ function longestMatch(...args) {
|
|
|
502
508
|
},
|
|
503
509
|
suggest: createExclusiveSuggest(parsers, combinedMode),
|
|
504
510
|
getDocFragments(state, _defaultValue) {
|
|
511
|
+
let brief;
|
|
505
512
|
let description;
|
|
506
513
|
let footer;
|
|
507
514
|
let fragments;
|
|
@@ -513,12 +520,14 @@ function longestMatch(...args) {
|
|
|
513
520
|
kind: "available",
|
|
514
521
|
state: result.next.state
|
|
515
522
|
});
|
|
523
|
+
brief = docResult.brief;
|
|
516
524
|
description = docResult.description;
|
|
517
525
|
footer = docResult.footer;
|
|
518
526
|
fragments = docResult.fragments;
|
|
519
527
|
} else fragments = parsers.flatMap((p) => p.getDocFragments({ kind: "unavailable" }).fragments);
|
|
520
528
|
}
|
|
521
529
|
return {
|
|
530
|
+
brief,
|
|
522
531
|
description,
|
|
523
532
|
fragments,
|
|
524
533
|
footer
|
package/dist/doc.d.cts
CHANGED
|
@@ -75,6 +75,12 @@ type DocFragment = {
|
|
|
75
75
|
* a final document page.
|
|
76
76
|
*/
|
|
77
77
|
interface DocFragments {
|
|
78
|
+
/**
|
|
79
|
+
* An optional brief that provides a short summary for the collection
|
|
80
|
+
* of fragments.
|
|
81
|
+
* @since 0.7.12
|
|
82
|
+
*/
|
|
83
|
+
readonly brief?: Message;
|
|
78
84
|
/**
|
|
79
85
|
* An optional description that applies to the entire collection of fragments.
|
|
80
86
|
*/
|
package/dist/doc.d.ts
CHANGED
|
@@ -75,6 +75,12 @@ type DocFragment = {
|
|
|
75
75
|
* a final document page.
|
|
76
76
|
*/
|
|
77
77
|
interface DocFragments {
|
|
78
|
+
/**
|
|
79
|
+
* An optional brief that provides a short summary for the collection
|
|
80
|
+
* of fragments.
|
|
81
|
+
* @since 0.7.12
|
|
82
|
+
*/
|
|
83
|
+
readonly brief?: Message;
|
|
78
84
|
/**
|
|
79
85
|
* An optional description that applies to the entire collection of fragments.
|
|
80
86
|
*/
|
package/dist/facade.cjs
CHANGED
|
@@ -583,15 +583,17 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
583
583
|
const displayHelp = (doc) => {
|
|
584
584
|
if (doc != null) {
|
|
585
585
|
const isMetaCommandHelp = (completionName === "singular" || completionName === "both" ? requestedCommand === "completion" : false) || (completionName === "plural" || completionName === "both" ? requestedCommand === "completions" : false) || requestedCommand === "help" || requestedCommand === "version";
|
|
586
|
-
const
|
|
586
|
+
const isSubcommandHelp = classified.commands.length > 0;
|
|
587
|
+
const isTopLevel = !isSubcommandHelp;
|
|
588
|
+
const shouldOverride = !isMetaCommandHelp && !isSubcommandHelp;
|
|
587
589
|
const augmentedDoc = {
|
|
588
590
|
...doc,
|
|
589
|
-
brief:
|
|
590
|
-
description:
|
|
591
|
+
brief: shouldOverride ? brief ?? doc.brief : doc.brief ?? brief,
|
|
592
|
+
description: shouldOverride ? description ?? doc.description : doc.description ?? description,
|
|
591
593
|
examples: isTopLevel && !isMetaCommandHelp ? examples ?? doc.examples : void 0,
|
|
592
594
|
author: isTopLevel && !isMetaCommandHelp ? author ?? doc.author : void 0,
|
|
593
595
|
bugs: isTopLevel && !isMetaCommandHelp ? bugs ?? doc.bugs : void 0,
|
|
594
|
-
footer:
|
|
596
|
+
footer: shouldOverride ? footer ?? doc.footer : doc.footer ?? footer
|
|
595
597
|
};
|
|
596
598
|
stdout(require_doc.formatDocPage(programName, augmentedDoc, {
|
|
597
599
|
colors,
|
package/dist/facade.js
CHANGED
|
@@ -583,15 +583,17 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
583
583
|
const displayHelp = (doc) => {
|
|
584
584
|
if (doc != null) {
|
|
585
585
|
const isMetaCommandHelp = (completionName === "singular" || completionName === "both" ? requestedCommand === "completion" : false) || (completionName === "plural" || completionName === "both" ? requestedCommand === "completions" : false) || requestedCommand === "help" || requestedCommand === "version";
|
|
586
|
-
const
|
|
586
|
+
const isSubcommandHelp = classified.commands.length > 0;
|
|
587
|
+
const isTopLevel = !isSubcommandHelp;
|
|
588
|
+
const shouldOverride = !isMetaCommandHelp && !isSubcommandHelp;
|
|
587
589
|
const augmentedDoc = {
|
|
588
590
|
...doc,
|
|
589
|
-
brief:
|
|
590
|
-
description:
|
|
591
|
+
brief: shouldOverride ? brief ?? doc.brief : doc.brief ?? brief,
|
|
592
|
+
description: shouldOverride ? description ?? doc.description : doc.description ?? description,
|
|
591
593
|
examples: isTopLevel && !isMetaCommandHelp ? examples ?? doc.examples : void 0,
|
|
592
594
|
author: isTopLevel && !isMetaCommandHelp ? author ?? doc.author : void 0,
|
|
593
595
|
bugs: isTopLevel && !isMetaCommandHelp ? bugs ?? doc.bugs : void 0,
|
|
594
|
-
footer:
|
|
596
|
+
footer: shouldOverride ? footer ?? doc.footer : doc.footer ?? footer
|
|
595
597
|
};
|
|
596
598
|
stdout(formatDocPage(programName, augmentedDoc, {
|
|
597
599
|
colors,
|
package/dist/parser.cjs
CHANGED
|
@@ -384,7 +384,7 @@ async function getDocPageAsyncImpl(parser, args, options) {
|
|
|
384
384
|
* Shared by both sync and async implementations.
|
|
385
385
|
*/
|
|
386
386
|
function buildDocPage(parser, context, args) {
|
|
387
|
-
const { description, fragments, footer } = parser.getDocFragments({
|
|
387
|
+
const { brief, description, fragments, footer } = parser.getDocFragments({
|
|
388
388
|
kind: "available",
|
|
389
389
|
state: context.state
|
|
390
390
|
}, void 0);
|
|
@@ -410,6 +410,7 @@ function buildDocPage(parser, context, args) {
|
|
|
410
410
|
return {
|
|
411
411
|
usage,
|
|
412
412
|
sections,
|
|
413
|
+
...brief != null && { brief },
|
|
413
414
|
...description != null && { description },
|
|
414
415
|
...footer != null && { footer }
|
|
415
416
|
};
|
package/dist/parser.js
CHANGED
|
@@ -384,7 +384,7 @@ async function getDocPageAsyncImpl(parser, args, options) {
|
|
|
384
384
|
* Shared by both sync and async implementations.
|
|
385
385
|
*/
|
|
386
386
|
function buildDocPage(parser, context, args) {
|
|
387
|
-
const { description, fragments, footer } = parser.getDocFragments({
|
|
387
|
+
const { brief, description, fragments, footer } = parser.getDocFragments({
|
|
388
388
|
kind: "available",
|
|
389
389
|
state: context.state
|
|
390
390
|
}, void 0);
|
|
@@ -410,6 +410,7 @@ function buildDocPage(parser, context, args) {
|
|
|
410
410
|
return {
|
|
411
411
|
usage,
|
|
412
412
|
sections,
|
|
413
|
+
...brief != null && { brief },
|
|
413
414
|
...description != null && { description },
|
|
414
415
|
...footer != null && { footer }
|
|
415
416
|
};
|
package/dist/primitives.cjs
CHANGED
|
@@ -992,6 +992,7 @@ function command(name, parser, options = {}) {
|
|
|
992
992
|
const innerFragments = parser.getDocFragments(innerState, defaultValue);
|
|
993
993
|
return {
|
|
994
994
|
...innerFragments,
|
|
995
|
+
brief: innerFragments.brief ?? options.brief,
|
|
995
996
|
description: innerFragments.description ?? options.description,
|
|
996
997
|
footer: innerFragments.footer ?? options.footer
|
|
997
998
|
};
|
package/dist/primitives.js
CHANGED
|
@@ -992,6 +992,7 @@ function command(name, parser, options = {}) {
|
|
|
992
992
|
const innerFragments = parser.getDocFragments(innerState, defaultValue);
|
|
993
993
|
return {
|
|
994
994
|
...innerFragments,
|
|
995
|
+
brief: innerFragments.brief ?? options.brief,
|
|
995
996
|
description: innerFragments.description ?? options.description,
|
|
996
997
|
footer: innerFragments.footer ?? options.footer
|
|
997
998
|
};
|