@optique/core 0.8.9 → 0.8.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/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 +5 -3
- package/dist/facade.js +5 -3
- 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
|
@@ -238,7 +238,9 @@ function or(...args) {
|
|
|
238
238
|
},
|
|
239
239
|
suggest: createExclusiveSuggest(parsers),
|
|
240
240
|
getDocFragments(state, _defaultValue) {
|
|
241
|
+
let brief;
|
|
241
242
|
let description;
|
|
243
|
+
let footer;
|
|
242
244
|
let fragments;
|
|
243
245
|
if (state.kind === "unavailable" || state.state == null) fragments = parsers.flatMap((p) => p.getDocFragments({ kind: "unavailable" }, void 0).fragments);
|
|
244
246
|
else {
|
|
@@ -248,7 +250,9 @@ function or(...args) {
|
|
|
248
250
|
state: parserResult.next.state
|
|
249
251
|
} : { kind: "unavailable" };
|
|
250
252
|
const docFragments = parsers[index].getDocFragments(innerState, void 0);
|
|
253
|
+
brief = docFragments.brief;
|
|
251
254
|
description = docFragments.description;
|
|
255
|
+
footer = docFragments.footer;
|
|
252
256
|
fragments = docFragments.fragments;
|
|
253
257
|
}
|
|
254
258
|
const entries = fragments.filter((f) => f.type === "entry");
|
|
@@ -259,7 +263,9 @@ function or(...args) {
|
|
|
259
263
|
else sections.push(fragment);
|
|
260
264
|
}
|
|
261
265
|
return {
|
|
266
|
+
brief,
|
|
262
267
|
description,
|
|
268
|
+
footer,
|
|
263
269
|
fragments: [...sections.map((s) => ({
|
|
264
270
|
...s,
|
|
265
271
|
type: "section"
|
|
@@ -333,6 +339,7 @@ function longestMatch(...args) {
|
|
|
333
339
|
},
|
|
334
340
|
suggest: createExclusiveSuggest(parsers),
|
|
335
341
|
getDocFragments(state, _defaultValue) {
|
|
342
|
+
let brief;
|
|
336
343
|
let description;
|
|
337
344
|
let footer;
|
|
338
345
|
let fragments;
|
|
@@ -344,12 +351,14 @@ function longestMatch(...args) {
|
|
|
344
351
|
kind: "available",
|
|
345
352
|
state: result.next.state
|
|
346
353
|
});
|
|
354
|
+
brief = docResult.brief;
|
|
347
355
|
description = docResult.description;
|
|
348
356
|
footer = docResult.footer;
|
|
349
357
|
fragments = docResult.fragments;
|
|
350
358
|
} else fragments = parsers.flatMap((p) => p.getDocFragments({ kind: "unavailable" }).fragments);
|
|
351
359
|
}
|
|
352
360
|
return {
|
|
361
|
+
brief,
|
|
353
362
|
description,
|
|
354
363
|
fragments,
|
|
355
364
|
footer
|
package/dist/constructs.js
CHANGED
|
@@ -238,7 +238,9 @@ function or(...args) {
|
|
|
238
238
|
},
|
|
239
239
|
suggest: createExclusiveSuggest(parsers),
|
|
240
240
|
getDocFragments(state, _defaultValue) {
|
|
241
|
+
let brief;
|
|
241
242
|
let description;
|
|
243
|
+
let footer;
|
|
242
244
|
let fragments;
|
|
243
245
|
if (state.kind === "unavailable" || state.state == null) fragments = parsers.flatMap((p) => p.getDocFragments({ kind: "unavailable" }, void 0).fragments);
|
|
244
246
|
else {
|
|
@@ -248,7 +250,9 @@ function or(...args) {
|
|
|
248
250
|
state: parserResult.next.state
|
|
249
251
|
} : { kind: "unavailable" };
|
|
250
252
|
const docFragments = parsers[index].getDocFragments(innerState, void 0);
|
|
253
|
+
brief = docFragments.brief;
|
|
251
254
|
description = docFragments.description;
|
|
255
|
+
footer = docFragments.footer;
|
|
252
256
|
fragments = docFragments.fragments;
|
|
253
257
|
}
|
|
254
258
|
const entries = fragments.filter((f) => f.type === "entry");
|
|
@@ -259,7 +263,9 @@ function or(...args) {
|
|
|
259
263
|
else sections.push(fragment);
|
|
260
264
|
}
|
|
261
265
|
return {
|
|
266
|
+
brief,
|
|
262
267
|
description,
|
|
268
|
+
footer,
|
|
263
269
|
fragments: [...sections.map((s) => ({
|
|
264
270
|
...s,
|
|
265
271
|
type: "section"
|
|
@@ -333,6 +339,7 @@ function longestMatch(...args) {
|
|
|
333
339
|
},
|
|
334
340
|
suggest: createExclusiveSuggest(parsers),
|
|
335
341
|
getDocFragments(state, _defaultValue) {
|
|
342
|
+
let brief;
|
|
336
343
|
let description;
|
|
337
344
|
let footer;
|
|
338
345
|
let fragments;
|
|
@@ -344,12 +351,14 @@ function longestMatch(...args) {
|
|
|
344
351
|
kind: "available",
|
|
345
352
|
state: result.next.state
|
|
346
353
|
});
|
|
354
|
+
brief = docResult.brief;
|
|
347
355
|
description = docResult.description;
|
|
348
356
|
footer = docResult.footer;
|
|
349
357
|
fragments = docResult.fragments;
|
|
350
358
|
} else fragments = parsers.flatMap((p) => p.getDocFragments({ kind: "unavailable" }).fragments);
|
|
351
359
|
}
|
|
352
360
|
return {
|
|
361
|
+
brief,
|
|
353
362
|
description,
|
|
354
363
|
fragments,
|
|
355
364
|
footer
|
package/dist/doc.d.cts
CHANGED
|
@@ -60,6 +60,12 @@ type DocFragment = {
|
|
|
60
60
|
* a final document page.
|
|
61
61
|
*/
|
|
62
62
|
interface DocFragments {
|
|
63
|
+
/**
|
|
64
|
+
* An optional brief that provides a short summary for the collection
|
|
65
|
+
* of fragments.
|
|
66
|
+
* @since 0.7.12
|
|
67
|
+
*/
|
|
68
|
+
readonly brief?: Message;
|
|
63
69
|
/**
|
|
64
70
|
* An optional description that applies to the entire collection of fragments.
|
|
65
71
|
*/
|
package/dist/doc.d.ts
CHANGED
|
@@ -60,6 +60,12 @@ type DocFragment = {
|
|
|
60
60
|
* a final document page.
|
|
61
61
|
*/
|
|
62
62
|
interface DocFragments {
|
|
63
|
+
/**
|
|
64
|
+
* An optional brief that provides a short summary for the collection
|
|
65
|
+
* of fragments.
|
|
66
|
+
* @since 0.7.12
|
|
67
|
+
*/
|
|
68
|
+
readonly brief?: Message;
|
|
63
69
|
/**
|
|
64
70
|
* An optional description that applies to the entire collection of fragments.
|
|
65
71
|
*/
|
package/dist/facade.cjs
CHANGED
|
@@ -561,11 +561,13 @@ function run(parser, programName, args, options = {}) {
|
|
|
561
561
|
const doc = require_parser.getDocPage(helpGeneratorParser, classified.commands);
|
|
562
562
|
if (doc != null) {
|
|
563
563
|
const isMetaCommandHelp = (completionName === "singular" || completionName === "both" ? requestedCommand === "completion" : false) || (completionName === "plural" || completionName === "both" ? requestedCommand === "completions" : false) || requestedCommand === "help" || requestedCommand === "version";
|
|
564
|
+
const isSubcommandHelp = classified.commands.length > 0;
|
|
565
|
+
const shouldOverride = !isMetaCommandHelp && !isSubcommandHelp;
|
|
564
566
|
const augmentedDoc = {
|
|
565
567
|
...doc,
|
|
566
|
-
brief:
|
|
567
|
-
description:
|
|
568
|
-
footer:
|
|
568
|
+
brief: shouldOverride ? brief ?? doc.brief : doc.brief ?? brief,
|
|
569
|
+
description: shouldOverride ? description ?? doc.description : doc.description ?? description,
|
|
570
|
+
footer: shouldOverride ? footer ?? doc.footer : doc.footer ?? footer
|
|
569
571
|
};
|
|
570
572
|
stdout(require_doc.formatDocPage(programName, augmentedDoc, {
|
|
571
573
|
colors,
|
package/dist/facade.js
CHANGED
|
@@ -561,11 +561,13 @@ function run(parser, programName, args, options = {}) {
|
|
|
561
561
|
const doc = getDocPage(helpGeneratorParser, classified.commands);
|
|
562
562
|
if (doc != null) {
|
|
563
563
|
const isMetaCommandHelp = (completionName === "singular" || completionName === "both" ? requestedCommand === "completion" : false) || (completionName === "plural" || completionName === "both" ? requestedCommand === "completions" : false) || requestedCommand === "help" || requestedCommand === "version";
|
|
564
|
+
const isSubcommandHelp = classified.commands.length > 0;
|
|
565
|
+
const shouldOverride = !isMetaCommandHelp && !isSubcommandHelp;
|
|
564
566
|
const augmentedDoc = {
|
|
565
567
|
...doc,
|
|
566
|
-
brief:
|
|
567
|
-
description:
|
|
568
|
-
footer:
|
|
568
|
+
brief: shouldOverride ? brief ?? doc.brief : doc.brief ?? brief,
|
|
569
|
+
description: shouldOverride ? description ?? doc.description : doc.description ?? description,
|
|
570
|
+
footer: shouldOverride ? footer ?? doc.footer : doc.footer ?? footer
|
|
569
571
|
};
|
|
570
572
|
stdout(formatDocPage(programName, augmentedDoc, {
|
|
571
573
|
colors,
|
package/dist/parser.cjs
CHANGED
|
@@ -159,7 +159,7 @@ function getDocPage(parser, args = []) {
|
|
|
159
159
|
if (!result.success) break;
|
|
160
160
|
context = result.next;
|
|
161
161
|
} while (context.buffer.length > 0);
|
|
162
|
-
const { description, fragments, footer } = parser.getDocFragments({
|
|
162
|
+
const { brief, description, fragments, footer } = parser.getDocFragments({
|
|
163
163
|
kind: "available",
|
|
164
164
|
state: context.state
|
|
165
165
|
}, void 0);
|
|
@@ -185,6 +185,7 @@ function getDocPage(parser, args = []) {
|
|
|
185
185
|
return {
|
|
186
186
|
usage,
|
|
187
187
|
sections,
|
|
188
|
+
...brief != null && { brief },
|
|
188
189
|
...description != null && { description },
|
|
189
190
|
...footer != null && { footer }
|
|
190
191
|
};
|
package/dist/parser.js
CHANGED
|
@@ -159,7 +159,7 @@ function getDocPage(parser, args = []) {
|
|
|
159
159
|
if (!result.success) break;
|
|
160
160
|
context = result.next;
|
|
161
161
|
} while (context.buffer.length > 0);
|
|
162
|
-
const { description, fragments, footer } = parser.getDocFragments({
|
|
162
|
+
const { brief, description, fragments, footer } = parser.getDocFragments({
|
|
163
163
|
kind: "available",
|
|
164
164
|
state: context.state
|
|
165
165
|
}, void 0);
|
|
@@ -185,6 +185,7 @@ function getDocPage(parser, args = []) {
|
|
|
185
185
|
return {
|
|
186
186
|
usage,
|
|
187
187
|
sections,
|
|
188
|
+
...brief != null && { brief },
|
|
188
189
|
...description != null && { description },
|
|
189
190
|
...footer != null && { footer }
|
|
190
191
|
};
|
package/dist/primitives.cjs
CHANGED
|
@@ -725,6 +725,7 @@ function command(name, parser, options = {}) {
|
|
|
725
725
|
const innerFragments = parser.getDocFragments(innerState, defaultValue);
|
|
726
726
|
return {
|
|
727
727
|
...innerFragments,
|
|
728
|
+
brief: innerFragments.brief ?? options.brief,
|
|
728
729
|
description: innerFragments.description ?? options.description,
|
|
729
730
|
footer: innerFragments.footer ?? options.footer
|
|
730
731
|
};
|
package/dist/primitives.js
CHANGED
|
@@ -725,6 +725,7 @@ function command(name, parser, options = {}) {
|
|
|
725
725
|
const innerFragments = parser.getDocFragments(innerState, defaultValue);
|
|
726
726
|
return {
|
|
727
727
|
...innerFragments,
|
|
728
|
+
brief: innerFragments.brief ?? options.brief,
|
|
728
729
|
description: innerFragments.description ?? options.description,
|
|
729
730
|
footer: innerFragments.footer ?? options.footer
|
|
730
731
|
};
|