@optique/core 0.4.0-dev.53 → 0.4.0-dev.55

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.js CHANGED
@@ -2,10 +2,257 @@ import { formatMessage, message } from "./message.js";
2
2
  import { formatUsage } from "./usage.js";
3
3
  import { formatDocPage } from "./doc.js";
4
4
  import { string } from "./valueparser.js";
5
- import { argument, command, constant, flag, getDocPage, longestMatch, merge, multiple, object, option, parse } from "./parser.js";
5
+ import { argument, command, constant, flag, getDocPage, longestMatch, multiple, object, optional, parse } from "./parser.js";
6
6
 
7
7
  //#region src/facade.ts
8
8
  /**
9
+ * Creates help parsers based on the specified mode.
10
+ */
11
+ function createHelpParser(mode) {
12
+ const helpCommand = command("help", multiple(argument(string({ metavar: "COMMAND" }))), { description: message`Show help information.` });
13
+ const helpOption = flag("--help", { description: message`Show help information.` });
14
+ const _contextualHelpParser = object({
15
+ help: constant(true),
16
+ version: constant(false),
17
+ commands: multiple(argument(string({
18
+ metavar: "COMMAND",
19
+ pattern: /^[^-].*$/
20
+ }))),
21
+ __help: flag("--help")
22
+ });
23
+ switch (mode) {
24
+ case "command": return {
25
+ helpCommand,
26
+ helpOption: null,
27
+ contextualHelpParser: null
28
+ };
29
+ case "option": return {
30
+ helpCommand: null,
31
+ helpOption,
32
+ contextualHelpParser: null
33
+ };
34
+ case "both": return {
35
+ helpCommand,
36
+ helpOption,
37
+ contextualHelpParser: null
38
+ };
39
+ }
40
+ }
41
+ /**
42
+ * Creates version parsers based on the specified mode.
43
+ */
44
+ function createVersionParser(mode) {
45
+ const versionCommand = command("version", object({}), { description: message`Show version information.` });
46
+ const versionOption = flag("--version", { description: message`Show version information.` });
47
+ switch (mode) {
48
+ case "command": return {
49
+ versionCommand,
50
+ versionOption: null
51
+ };
52
+ case "option": return {
53
+ versionCommand: null,
54
+ versionOption
55
+ };
56
+ case "both": return {
57
+ versionCommand,
58
+ versionOption
59
+ };
60
+ }
61
+ }
62
+ /**
63
+ * Systematically combines the original parser with help and version parsers.
64
+ */
65
+ function combineWithHelpVersion(originalParser, helpParsers, versionParsers) {
66
+ const parsers = [];
67
+ if (helpParsers.helpOption) {
68
+ const lenientHelpParser = {
69
+ $valueType: [],
70
+ $stateType: [],
71
+ priority: 200,
72
+ usage: helpParsers.helpOption.usage,
73
+ initialState: null,
74
+ parse(context) {
75
+ const { buffer, optionsTerminated } = context;
76
+ if (optionsTerminated) return {
77
+ success: false,
78
+ error: message`Options terminated`,
79
+ consumed: 0
80
+ };
81
+ let helpFound = false;
82
+ let helpIndex = -1;
83
+ let helpCount = 0;
84
+ let versionIndex = -1;
85
+ for (let i = 0; i < buffer.length; i++) {
86
+ if (buffer[i] === "--") break;
87
+ if (buffer[i] === "--help") {
88
+ helpFound = true;
89
+ helpIndex = i;
90
+ helpCount++;
91
+ }
92
+ if (buffer[i] === "--version") versionIndex = i;
93
+ }
94
+ if (helpFound && versionIndex > helpIndex) return {
95
+ success: false,
96
+ error: message`Version option wins`,
97
+ consumed: 0
98
+ };
99
+ if (helpFound) return {
100
+ success: true,
101
+ next: {
102
+ ...context,
103
+ buffer: [],
104
+ state: {
105
+ help: true,
106
+ version: false,
107
+ commands: [],
108
+ helpFlag: true
109
+ }
110
+ },
111
+ consumed: buffer.slice(0)
112
+ };
113
+ return {
114
+ success: false,
115
+ error: message`Flag --help not found`,
116
+ consumed: 0
117
+ };
118
+ },
119
+ complete(state) {
120
+ return {
121
+ success: true,
122
+ value: state
123
+ };
124
+ },
125
+ getDocFragments(state) {
126
+ return helpParsers.helpOption?.getDocFragments(state) ?? { fragments: [] };
127
+ }
128
+ };
129
+ parsers.push(lenientHelpParser);
130
+ }
131
+ if (versionParsers.versionOption) {
132
+ const lenientVersionParser = {
133
+ $valueType: [],
134
+ $stateType: [],
135
+ priority: 200,
136
+ usage: versionParsers.versionOption.usage,
137
+ initialState: null,
138
+ parse(context) {
139
+ const { buffer, optionsTerminated } = context;
140
+ if (optionsTerminated) return {
141
+ success: false,
142
+ error: message`Options terminated`,
143
+ consumed: 0
144
+ };
145
+ let versionFound = false;
146
+ let versionIndex = -1;
147
+ let versionCount = 0;
148
+ let helpIndex = -1;
149
+ for (let i = 0; i < buffer.length; i++) {
150
+ if (buffer[i] === "--") break;
151
+ if (buffer[i] === "--version") {
152
+ versionFound = true;
153
+ versionIndex = i;
154
+ versionCount++;
155
+ }
156
+ if (buffer[i] === "--help") helpIndex = i;
157
+ }
158
+ if (versionFound && helpIndex > versionIndex) return {
159
+ success: false,
160
+ error: message`Help option wins`,
161
+ consumed: 0
162
+ };
163
+ if (versionFound) return {
164
+ success: true,
165
+ next: {
166
+ ...context,
167
+ buffer: [],
168
+ state: {
169
+ help: false,
170
+ version: true,
171
+ versionFlag: true
172
+ }
173
+ },
174
+ consumed: buffer.slice(0)
175
+ };
176
+ return {
177
+ success: false,
178
+ error: message`Flag --version not found`,
179
+ consumed: 0
180
+ };
181
+ },
182
+ complete(state) {
183
+ return {
184
+ success: true,
185
+ value: state
186
+ };
187
+ },
188
+ getDocFragments(state) {
189
+ return versionParsers.versionOption?.getDocFragments(state) ?? { fragments: [] };
190
+ }
191
+ };
192
+ parsers.push(lenientVersionParser);
193
+ }
194
+ if (versionParsers.versionCommand) parsers.push(object({
195
+ help: constant(false),
196
+ version: constant(true),
197
+ result: versionParsers.versionCommand,
198
+ helpFlag: helpParsers.helpOption ? optional(helpParsers.helpOption) : constant(false)
199
+ }));
200
+ if (helpParsers.helpCommand) parsers.push(object({
201
+ help: constant(true),
202
+ version: constant(false),
203
+ commands: helpParsers.helpCommand
204
+ }));
205
+ if (helpParsers.contextualHelpParser) parsers.push(helpParsers.contextualHelpParser);
206
+ parsers.push(object({
207
+ help: constant(false),
208
+ version: constant(false),
209
+ result: originalParser
210
+ }));
211
+ if (parsers.length === 1) return parsers[0];
212
+ else if (parsers.length === 2) return longestMatch(parsers[0], parsers[1]);
213
+ else return longestMatch(...parsers);
214
+ }
215
+ /**
216
+ * Classifies the parsing result into a discriminated union for cleaner handling.
217
+ */
218
+ function classifyResult(result, args) {
219
+ if (!result.success) return {
220
+ type: "error",
221
+ error: result.error
222
+ };
223
+ const value = result.value;
224
+ if (typeof value === "object" && value != null && "help" in value && "version" in value) {
225
+ const parsedValue = value;
226
+ const hasVersionOption = args.includes("--version");
227
+ const hasVersionCommand = args.length > 0 && args[0] === "version";
228
+ const hasHelpOption = args.includes("--help");
229
+ const hasHelpCommand = args.length > 0 && args[0] === "help";
230
+ if (hasVersionOption && hasHelpOption && !hasVersionCommand && !hasHelpCommand) {}
231
+ if (hasVersionCommand && hasHelpOption && parsedValue.helpFlag) return {
232
+ type: "help",
233
+ commands: ["version"]
234
+ };
235
+ if (parsedValue.help && (hasHelpOption || hasHelpCommand)) {
236
+ let commandContext = [];
237
+ if (Array.isArray(parsedValue.commands)) commandContext = parsedValue.commands;
238
+ else if (typeof parsedValue.commands === "object" && parsedValue.commands != null && "length" in parsedValue.commands) commandContext = parsedValue.commands;
239
+ return {
240
+ type: "help",
241
+ commands: commandContext
242
+ };
243
+ }
244
+ if ((hasVersionOption || hasVersionCommand) && (parsedValue.version || parsedValue.versionFlag)) return { type: "version" };
245
+ return {
246
+ type: "success",
247
+ value: parsedValue.result ?? value
248
+ };
249
+ }
250
+ return {
251
+ type: "success",
252
+ value
253
+ };
254
+ }
255
+ /**
9
256
  * Runs a parser against command-line arguments with built-in help and error
10
257
  * handling.
11
258
  *
@@ -40,268 +287,73 @@ function run(parser, programName, args, options = {}) {
40
287
  const versionMode = options.version?.mode ?? "option";
41
288
  const versionValue = options.version?.value ?? "";
42
289
  const onVersion = options.version?.onShow ?? (() => ({}));
43
- let { colors, maxWidth, aboveError = "usage", onError = () => {
290
+ let { colors, maxWidth, showDefault, aboveError = "usage", onError = () => {
44
291
  throw new RunError("Failed to parse command line arguments.");
45
292
  }, stderr = console.error, stdout = console.log } = options;
46
293
  const help = options.help ? helpMode : "none";
47
- const contextualHelpParser = object({
48
- help: constant(true),
49
- version: constant(false),
50
- commands: multiple(argument(string({
51
- metavar: "COMMAND",
52
- pattern: /^[^-].*$/
53
- }))),
54
- __help: flag("--help")
55
- });
56
- const helpCommand = command("help", multiple(argument(string({ metavar: "COMMAND" }))), { description: message`Show help information.` });
57
- const helpOption = option("--help", { description: message`Show help information.` });
58
294
  const version = options.version ? versionMode : "none";
59
- const versionCommand = command("version", object({}), { description: message`Show version information.` });
60
- const versionOption = option("--version", { description: message`Show version information.` });
61
- const augmentedParser = help === "none" && version === "none" ? parser : help === "none" && version === "command" ? longestMatch(object({
62
- help: constant(false),
63
- version: constant(true),
64
- result: versionCommand
65
- }), object({
66
- help: constant(false),
67
- version: constant(false),
68
- result: parser
69
- })) : help === "none" && version === "option" ? longestMatch(object({
70
- help: constant(false),
71
- version: constant(false),
72
- result: parser
73
- }), merge(object({
74
- help: constant(false),
75
- version: constant(true)
76
- }), object({ versionFlag: versionOption }))) : help === "none" && version === "both" ? longestMatch(object({
77
- help: constant(false),
78
- version: constant(true),
79
- result: versionCommand
80
- }), object({
81
- help: constant(false),
82
- version: constant(false),
83
- result: parser
84
- }), merge(object({
85
- help: constant(false),
86
- version: constant(true)
87
- }), object({ versionFlag: versionOption }))) : help === "command" && version === "none" ? longestMatch(object({
88
- help: constant(true),
89
- version: constant(false),
90
- commands: helpCommand
91
- }), object({
92
- help: constant(false),
93
- version: constant(false),
94
- result: parser
95
- })) : help === "command" && version === "command" ? longestMatch(object({
96
- help: constant(true),
97
- version: constant(false),
98
- commands: helpCommand
99
- }), object({
100
- help: constant(false),
101
- version: constant(true),
102
- result: versionCommand
103
- }), object({
104
- help: constant(false),
105
- version: constant(false),
106
- result: parser
107
- })) : help === "command" && version === "option" ? longestMatch(object({
108
- help: constant(true),
109
- version: constant(false),
110
- commands: helpCommand
111
- }), object({
112
- help: constant(false),
113
- version: constant(false),
114
- result: parser
115
- }), merge(object({
116
- help: constant(false),
117
- version: constant(true)
118
- }), object({ versionFlag: versionOption }))) : help === "command" && version === "both" ? longestMatch(object({
119
- help: constant(true),
120
- version: constant(false),
121
- commands: helpCommand
122
- }), object({
123
- help: constant(false),
124
- version: constant(true),
125
- result: versionCommand
126
- }), object({
127
- help: constant(false),
128
- version: constant(false),
129
- result: parser
130
- }), merge(object({
131
- help: constant(false),
132
- version: constant(true)
133
- }), object({ versionFlag: versionOption }))) : help === "option" && version === "none" ? longestMatch(object({
134
- help: constant(false),
135
- version: constant(false),
136
- result: parser
137
- }), contextualHelpParser, merge(object({
138
- help: constant(true),
139
- version: constant(false),
140
- commands: constant([])
141
- }), object({ helpFlag: helpOption }))) : help === "option" && version === "command" ? longestMatch(object({
142
- help: constant(false),
143
- version: constant(true),
144
- result: versionCommand
145
- }), object({
146
- help: constant(false),
147
- version: constant(false),
148
- result: parser
149
- }), contextualHelpParser, merge(object({
150
- help: constant(true),
151
- version: constant(false),
152
- commands: constant([])
153
- }), object({ helpFlag: helpOption }))) : help === "option" && version === "option" ? longestMatch(merge(object({
154
- help: constant(false),
155
- version: constant(true)
156
- }), object({ versionFlag: versionOption })), object({
157
- help: constant(false),
158
- version: constant(false),
159
- result: parser
160
- }), contextualHelpParser, merge(object({
161
- help: constant(true),
162
- version: constant(false),
163
- commands: constant([])
164
- }), object({ helpFlag: helpOption }))) : help === "option" && version === "both" ? longestMatch(merge(object({
165
- help: constant(false),
166
- version: constant(true)
167
- }), object({ versionFlag: versionOption })), object({
168
- help: constant(false),
169
- version: constant(true),
170
- result: versionCommand
171
- }), object({
172
- help: constant(false),
173
- version: constant(false),
174
- result: parser
175
- }), contextualHelpParser, merge(object({
176
- help: constant(true),
177
- version: constant(false),
178
- commands: constant([])
179
- }), object({ helpFlag: helpOption }))) : help === "both" && version === "none" ? longestMatch(object({
180
- help: constant(false),
181
- version: constant(false),
182
- result: parser
183
- }), object({
184
- help: constant(true),
185
- version: constant(false),
186
- commands: helpCommand
187
- }), contextualHelpParser, merge(object({
188
- help: constant(true),
189
- version: constant(false),
190
- commands: constant([])
191
- }), object({ helpFlag: helpOption }))) : help === "both" && version === "command" ? longestMatch(object({
192
- help: constant(true),
193
- version: constant(false),
194
- commands: helpCommand
195
- }), object({
196
- help: constant(false),
197
- version: constant(true),
198
- result: versionCommand
199
- }), object({
200
- help: constant(false),
201
- version: constant(false),
202
- result: parser
203
- }), contextualHelpParser, merge(object({
204
- help: constant(true),
205
- version: constant(false),
206
- commands: constant([])
207
- }), object({ helpFlag: helpOption }))) : help === "both" && version === "option" ? longestMatch(merge(object({
208
- help: constant(false),
209
- version: constant(true)
210
- }), object({ versionFlag: versionOption })), object({
211
- help: constant(true),
212
- version: constant(false),
213
- commands: helpCommand
214
- }), object({
215
- help: constant(false),
216
- version: constant(false),
217
- result: parser
218
- }), contextualHelpParser, merge(object({
219
- help: constant(true),
220
- version: constant(false),
221
- commands: constant([])
222
- }), object({ helpFlag: helpOption }))) : longestMatch(merge(object({
223
- help: constant(false),
224
- version: constant(true)
225
- }), object({ versionFlag: versionOption })), object({
226
- help: constant(false),
227
- version: constant(true),
228
- result: versionCommand
229
- }), object({
230
- help: constant(true),
231
- version: constant(false),
232
- commands: helpCommand
233
- }), object({
234
- help: constant(false),
235
- version: constant(false),
236
- result: parser
237
- }), longestMatch(contextualHelpParser, merge(object({
238
- help: constant(true),
239
- version: constant(false),
240
- commands: constant([])
241
- }), object({ helpFlag: helpOption }))));
242
- let result = parse(augmentedParser, args);
243
- if (result.success && typeof result.value === "object" && result.value != null && "help" in result.value && "version" in result.value) {
244
- const parsedValue = result.value;
245
- const hasVersionInput = args.includes("--version") || args.length > 0 && args[0] === "version";
246
- const hasHelpInput = args.includes("--help") || args.length > 0 && args[0] === "help";
247
- if (parsedValue.version && !hasVersionInput || parsedValue.help && !hasHelpInput && !parsedValue.result) result = parse(parser, args);
248
- }
249
- if (result.success) {
250
- const value = result.value;
251
- if (help === "none" && version === "none") return value;
252
- if (typeof value === "object" && value != null && "help" in value && "version" in value) {
253
- const parsedValue = value;
254
- if (parsedValue.version) {
255
- const hasVersionOption = args.includes("--version");
256
- const hasVersionCommand = args.length > 0 && args[0] === "version";
257
- if (hasVersionOption || hasVersionCommand) {
258
- stdout(versionValue);
259
- try {
260
- return onVersion(0);
261
- } catch {
262
- return onVersion();
263
- }
264
- }
295
+ const helpParsers = help === "none" ? {
296
+ helpCommand: null,
297
+ helpOption: null,
298
+ contextualHelpParser: null
299
+ } : createHelpParser(help);
300
+ const versionParsers = version === "none" ? {
301
+ versionCommand: null,
302
+ versionOption: null
303
+ } : createVersionParser(version);
304
+ const augmentedParser = help === "none" && version === "none" ? parser : combineWithHelpVersion(parser, helpParsers, versionParsers);
305
+ const result = parse(augmentedParser, args);
306
+ const classified = classifyResult(result, args);
307
+ switch (classified.type) {
308
+ case "success": return classified.value;
309
+ case "version":
310
+ stdout(versionValue);
311
+ try {
312
+ return onVersion(0);
313
+ } catch {
314
+ return onVersion();
265
315
  }
266
- if (parsedValue.help) {
267
- if (version !== "none" && args.includes("--version")) {
268
- stdout(versionValue);
269
- try {
270
- return onVersion(0);
271
- } catch {
272
- return onVersion();
273
- }
274
- }
275
- let commandContext = [];
276
- if (Array.isArray(parsedValue.commands)) commandContext = parsedValue.commands;
277
- else if (typeof parsedValue.commands === "object" && parsedValue.commands != null && "length" in parsedValue.commands) commandContext = parsedValue.commands;
278
- let helpGeneratorParser;
279
- const helpAsCommand = help === "command" || help === "both";
280
- const versionAsCommand = version === "command" || version === "both";
281
- if (helpAsCommand && versionAsCommand) helpGeneratorParser = longestMatch(parser, helpCommand, versionCommand);
282
- else if (helpAsCommand) helpGeneratorParser = longestMatch(parser, helpCommand);
283
- else if (versionAsCommand) helpGeneratorParser = longestMatch(parser, versionCommand);
316
+ case "help": {
317
+ let helpGeneratorParser;
318
+ const helpAsCommand = help === "command" || help === "both";
319
+ const versionAsCommand = version === "command" || version === "both";
320
+ if (helpAsCommand && versionAsCommand) {
321
+ const tempHelpParsers = createHelpParser(help);
322
+ const tempVersionParsers = createVersionParser(version);
323
+ if (tempHelpParsers.helpCommand && tempVersionParsers.versionCommand) helpGeneratorParser = longestMatch(parser, tempHelpParsers.helpCommand, tempVersionParsers.versionCommand);
324
+ else if (tempHelpParsers.helpCommand) helpGeneratorParser = longestMatch(parser, tempHelpParsers.helpCommand);
325
+ else if (tempVersionParsers.versionCommand) helpGeneratorParser = longestMatch(parser, tempVersionParsers.versionCommand);
284
326
  else helpGeneratorParser = parser;
285
- const doc = getDocPage(commandContext.length < 1 ? helpGeneratorParser : parser, commandContext);
286
- if (doc != null) stdout(formatDocPage(programName, doc, {
287
- colors,
288
- maxWidth
289
- }));
290
- try {
291
- return onHelp(0);
292
- } catch {
293
- return onHelp();
294
- }
327
+ } else if (helpAsCommand) {
328
+ const tempHelpParsers = createHelpParser(help);
329
+ if (tempHelpParsers.helpCommand) helpGeneratorParser = longestMatch(parser, tempHelpParsers.helpCommand);
330
+ else helpGeneratorParser = parser;
331
+ } else if (versionAsCommand) {
332
+ const tempVersionParsers = createVersionParser(version);
333
+ if (tempVersionParsers.versionCommand) helpGeneratorParser = longestMatch(parser, tempVersionParsers.versionCommand);
334
+ else helpGeneratorParser = parser;
335
+ } else helpGeneratorParser = parser;
336
+ const doc = getDocPage(helpGeneratorParser, classified.commands);
337
+ if (doc != null) stdout(formatDocPage(programName, doc, {
338
+ colors,
339
+ maxWidth,
340
+ showDefault
341
+ }));
342
+ try {
343
+ return onHelp(0);
344
+ } catch {
345
+ return onHelp();
295
346
  }
296
- return parsedValue.result ?? value;
297
- } else return value;
347
+ }
348
+ case "error": break;
298
349
  }
299
350
  if (aboveError === "help") {
300
351
  const doc = getDocPage(args.length < 1 ? augmentedParser : parser, args);
301
352
  if (doc == null) aboveError = "usage";
302
353
  else stderr(formatDocPage(programName, doc, {
303
354
  colors,
304
- maxWidth
355
+ maxWidth,
356
+ showDefault
305
357
  }));
306
358
  }
307
359
  if (aboveError === "usage") stderr(`Usage: ${indentLines(formatUsage(programName, augmentedParser.usage, {
@@ -309,10 +361,11 @@ function run(parser, programName, args, options = {}) {
309
361
  maxWidth: maxWidth == null ? void 0 : maxWidth - 7,
310
362
  expandCommands: true
311
363
  }), 7)}`);
312
- stderr(`Error: ${formatMessage(result.error, {
364
+ const errorMessage = formatMessage(classified.error, {
313
365
  colors,
314
366
  quotes: !colors
315
- })}`);
367
+ });
368
+ stderr(`Error: ${errorMessage}`);
316
369
  return onError(1);
317
370
  }
318
371
  /**
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Message, MessageFormatOptions, MessageTerm, formatMessage, message, metavar, optionName, optionNames, text, value, values } from "./message.cjs";
2
2
  import { OptionName, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, formatUsage, formatUsageTerm, normalizeUsage } from "./usage.cjs";
3
- import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, formatDocPage } from "./doc.cjs";
3
+ import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowDefaultOptions, formatDocPage } from "./doc.cjs";
4
4
  import { ChoiceOptions, FloatOptions, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, StringOptions, UrlOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, choice, float, integer, isValueParser, locale, string, url, uuid } from "./valueparser.cjs";
5
5
  import { ArgumentOptions, CommandOptions, DocState, FlagOptions, InferValue, MultipleOptions, OptionOptions, Parser, ParserContext, ParserResult, Result, argument, command, concat, constant, flag, getDocPage, group, longestMatch, map, merge, multiple, object, option, optional, or, parse, tuple, withDefault } from "./parser.cjs";
6
6
  import { RunError, RunOptions, run } from "./facade.cjs";
7
- export { ArgumentOptions, ChoiceOptions, CommandOptions, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, FlagOptions, FloatOptions, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, Message, MessageFormatOptions, MessageTerm, MultipleOptions, OptionName, OptionOptions, Parser, ParserContext, ParserResult, Result, RunError, RunOptions, StringOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, argument, choice, command, concat, constant, flag, float, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDocPage, group, integer, isValueParser, locale, longestMatch, map, merge, message, metavar, multiple, normalizeUsage, object, option, optionName, optionNames, optional, or, parse, run, string, text, tuple, url, uuid, value, values, withDefault };
7
+ export { ArgumentOptions, ChoiceOptions, CommandOptions, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, FlagOptions, FloatOptions, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, Message, MessageFormatOptions, MessageTerm, MultipleOptions, OptionName, OptionOptions, Parser, ParserContext, ParserResult, Result, RunError, RunOptions, ShowDefaultOptions, StringOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, argument, choice, command, concat, constant, flag, float, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDocPage, group, integer, isValueParser, locale, longestMatch, map, merge, message, metavar, multiple, normalizeUsage, object, option, optionName, optionNames, optional, or, parse, run, string, text, tuple, url, uuid, value, values, withDefault };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Message, MessageFormatOptions, MessageTerm, formatMessage, message, metavar, optionName, optionNames, text, value, values } from "./message.js";
2
2
  import { OptionName, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, formatUsage, formatUsageTerm, normalizeUsage } from "./usage.js";
3
- import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, formatDocPage } from "./doc.js";
3
+ import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowDefaultOptions, formatDocPage } from "./doc.js";
4
4
  import { ChoiceOptions, FloatOptions, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, StringOptions, UrlOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, choice, float, integer, isValueParser, locale, string, url, uuid } from "./valueparser.js";
5
5
  import { ArgumentOptions, CommandOptions, DocState, FlagOptions, InferValue, MultipleOptions, OptionOptions, Parser, ParserContext, ParserResult, Result, argument, command, concat, constant, flag, getDocPage, group, longestMatch, map, merge, multiple, object, option, optional, or, parse, tuple, withDefault } from "./parser.js";
6
6
  import { RunError, RunOptions, run } from "./facade.js";
7
- export { ArgumentOptions, ChoiceOptions, CommandOptions, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, FlagOptions, FloatOptions, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, Message, MessageFormatOptions, MessageTerm, MultipleOptions, OptionName, OptionOptions, Parser, ParserContext, ParserResult, Result, RunError, RunOptions, StringOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, argument, choice, command, concat, constant, flag, float, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDocPage, group, integer, isValueParser, locale, longestMatch, map, merge, message, metavar, multiple, normalizeUsage, object, option, optionName, optionNames, optional, or, parse, run, string, text, tuple, url, uuid, value, values, withDefault };
7
+ export { ArgumentOptions, ChoiceOptions, CommandOptions, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, FlagOptions, FloatOptions, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, Message, MessageFormatOptions, MessageTerm, MultipleOptions, OptionName, OptionOptions, Parser, ParserContext, ParserResult, Result, RunError, RunOptions, ShowDefaultOptions, StringOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, argument, choice, command, concat, constant, flag, float, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDocPage, group, integer, isValueParser, locale, longestMatch, map, merge, message, metavar, multiple, normalizeUsage, object, option, optionName, optionNames, optional, or, parse, run, string, text, tuple, url, uuid, value, values, withDefault };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "0.4.0-dev.53+b5f185f5",
3
+ "version": "0.4.0-dev.55+0d83fe23",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",