@optique/core 0.4.0-dev.56 → 0.4.0-dev.58

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 CHANGED
@@ -289,7 +289,7 @@ function run(parser, programName, args, options = {}) {
289
289
  const onVersion = options.version?.onShow ?? (() => ({}));
290
290
  let { colors, maxWidth, showDefault, aboveError = "usage", onError = () => {
291
291
  throw new RunError("Failed to parse command line arguments.");
292
- }, stderr = console.error, stdout = console.log } = options;
292
+ }, stderr = console.error, stdout = console.log, brief, description, footer } = options;
293
293
  const help = options.help ? helpMode : "none";
294
294
  const version = options.version ? versionMode : "none";
295
295
  const helpParsers = help === "none" ? {
@@ -334,11 +334,19 @@ function run(parser, programName, args, options = {}) {
334
334
  else helpGeneratorParser = parser;
335
335
  } else helpGeneratorParser = parser;
336
336
  const doc = require_parser.getDocPage(helpGeneratorParser, classified.commands);
337
- if (doc != null) stdout(require_doc.formatDocPage(programName, doc, {
338
- colors,
339
- maxWidth,
340
- showDefault
341
- }));
337
+ if (doc != null) {
338
+ const augmentedDoc = {
339
+ ...doc,
340
+ brief: brief ?? doc.brief,
341
+ description: description ?? doc.description,
342
+ footer: footer ?? doc.footer
343
+ };
344
+ stdout(require_doc.formatDocPage(programName, augmentedDoc, {
345
+ colors,
346
+ maxWidth,
347
+ showDefault
348
+ }));
349
+ }
342
350
  try {
343
351
  return onHelp(0);
344
352
  } catch {
@@ -350,11 +358,19 @@ function run(parser, programName, args, options = {}) {
350
358
  if (aboveError === "help") {
351
359
  const doc = require_parser.getDocPage(args.length < 1 ? augmentedParser : parser, args);
352
360
  if (doc == null) aboveError = "usage";
353
- else stderr(require_doc.formatDocPage(programName, doc, {
354
- colors,
355
- maxWidth,
356
- showDefault
357
- }));
361
+ else {
362
+ const augmentedDoc = {
363
+ ...doc,
364
+ brief: brief ?? doc.brief,
365
+ description: description ?? doc.description,
366
+ footer: footer ?? doc.footer
367
+ };
368
+ stderr(require_doc.formatDocPage(programName, augmentedDoc, {
369
+ colors,
370
+ maxWidth,
371
+ showDefault
372
+ }));
373
+ }
358
374
  }
359
375
  if (aboveError === "usage") stderr(`Usage: ${indentLines(require_usage.formatUsage(programName, augmentedParser.usage, {
360
376
  colors,
package/dist/facade.d.cts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Message } from "./message.cjs";
1
2
  import { ShowDefaultOptions } from "./doc.cjs";
2
3
  import { InferValue, Parser } from "./parser.cjs";
3
4
 
@@ -117,6 +118,24 @@ interface RunOptions<THelp, TError> {
117
118
  * @default `console.log`
118
119
  */
119
120
  readonly stdout?: (text: string) => void;
121
+ /**
122
+ * Brief description shown at the top of help text.
123
+ *
124
+ * @since 0.4.0
125
+ */
126
+ readonly brief?: Message;
127
+ /**
128
+ * Detailed description shown after the usage line.
129
+ *
130
+ * @since 0.4.0
131
+ */
132
+ readonly description?: Message;
133
+ /**
134
+ * Footer text shown at the bottom of help text.
135
+ *
136
+ * @since 0.4.0
137
+ */
138
+ readonly footer?: Message;
120
139
  }
121
140
  /**
122
141
  * Runs a parser against command-line arguments with built-in help and error
package/dist/facade.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Message } from "./message.js";
1
2
  import { ShowDefaultOptions } from "./doc.js";
2
3
  import { InferValue, Parser } from "./parser.js";
3
4
 
@@ -117,6 +118,24 @@ interface RunOptions<THelp, TError> {
117
118
  * @default `console.log`
118
119
  */
119
120
  readonly stdout?: (text: string) => void;
121
+ /**
122
+ * Brief description shown at the top of help text.
123
+ *
124
+ * @since 0.4.0
125
+ */
126
+ readonly brief?: Message;
127
+ /**
128
+ * Detailed description shown after the usage line.
129
+ *
130
+ * @since 0.4.0
131
+ */
132
+ readonly description?: Message;
133
+ /**
134
+ * Footer text shown at the bottom of help text.
135
+ *
136
+ * @since 0.4.0
137
+ */
138
+ readonly footer?: Message;
120
139
  }
121
140
  /**
122
141
  * Runs a parser against command-line arguments with built-in help and error
package/dist/facade.js CHANGED
@@ -289,7 +289,7 @@ function run(parser, programName, args, options = {}) {
289
289
  const onVersion = options.version?.onShow ?? (() => ({}));
290
290
  let { colors, maxWidth, showDefault, aboveError = "usage", onError = () => {
291
291
  throw new RunError("Failed to parse command line arguments.");
292
- }, stderr = console.error, stdout = console.log } = options;
292
+ }, stderr = console.error, stdout = console.log, brief, description, footer } = options;
293
293
  const help = options.help ? helpMode : "none";
294
294
  const version = options.version ? versionMode : "none";
295
295
  const helpParsers = help === "none" ? {
@@ -334,11 +334,19 @@ function run(parser, programName, args, options = {}) {
334
334
  else helpGeneratorParser = parser;
335
335
  } else helpGeneratorParser = parser;
336
336
  const doc = getDocPage(helpGeneratorParser, classified.commands);
337
- if (doc != null) stdout(formatDocPage(programName, doc, {
338
- colors,
339
- maxWidth,
340
- showDefault
341
- }));
337
+ if (doc != null) {
338
+ const augmentedDoc = {
339
+ ...doc,
340
+ brief: brief ?? doc.brief,
341
+ description: description ?? doc.description,
342
+ footer: footer ?? doc.footer
343
+ };
344
+ stdout(formatDocPage(programName, augmentedDoc, {
345
+ colors,
346
+ maxWidth,
347
+ showDefault
348
+ }));
349
+ }
342
350
  try {
343
351
  return onHelp(0);
344
352
  } catch {
@@ -350,11 +358,19 @@ function run(parser, programName, args, options = {}) {
350
358
  if (aboveError === "help") {
351
359
  const doc = getDocPage(args.length < 1 ? augmentedParser : parser, args);
352
360
  if (doc == null) aboveError = "usage";
353
- else stderr(formatDocPage(programName, doc, {
354
- colors,
355
- maxWidth,
356
- showDefault
357
- }));
361
+ else {
362
+ const augmentedDoc = {
363
+ ...doc,
364
+ brief: brief ?? doc.brief,
365
+ description: description ?? doc.description,
366
+ footer: footer ?? doc.footer
367
+ };
368
+ stderr(formatDocPage(programName, augmentedDoc, {
369
+ colors,
370
+ maxWidth,
371
+ showDefault
372
+ }));
373
+ }
358
374
  }
359
375
  if (aboveError === "usage") stderr(`Usage: ${indentLines(formatUsage(programName, augmentedParser.usage, {
360
376
  colors,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "0.4.0-dev.56+2ae81fd7",
3
+ "version": "0.4.0-dev.58+657dc3fa",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",