@optique/core 1.0.0-dev.1309 → 1.0.0-dev.1315
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/doc.cjs +6 -1
- package/dist/doc.d.cts +4 -2
- package/dist/doc.d.ts +4 -2
- package/dist/doc.js +6 -1
- package/dist/modifiers.cjs +1 -1
- package/dist/modifiers.js +1 -1
- package/dist/suggestion.cjs +1 -1
- package/dist/suggestion.js +1 -1
- package/package.json +1 -1
package/dist/doc.cjs
CHANGED
|
@@ -51,7 +51,8 @@ function defaultSectionOrder(a, b) {
|
|
|
51
51
|
* any non-empty section's title is empty, whitespace-only, or contains a CR
|
|
52
52
|
* or LF character, or if `maxWidth` is not a finite integer.
|
|
53
53
|
* @throws {RangeError} If any entry needs a description column and `maxWidth`
|
|
54
|
-
* is too small to fit the minimum layout (less than `termIndent + 4`)
|
|
54
|
+
* is too small to fit the minimum layout (less than `termIndent + 4`), or if
|
|
55
|
+
* `showChoices.maxItems` is less than `1`.
|
|
55
56
|
*
|
|
56
57
|
* @example
|
|
57
58
|
* ```typescript
|
|
@@ -87,6 +88,10 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
87
88
|
...page,
|
|
88
89
|
sections: filteredSections
|
|
89
90
|
};
|
|
91
|
+
if (typeof options.showChoices === "object" && options.showChoices.maxItems != null) {
|
|
92
|
+
const maxItems = options.showChoices.maxItems;
|
|
93
|
+
if (maxItems < 1) throw new RangeError(`showChoices.maxItems must be at least 1, but got ${maxItems}.`);
|
|
94
|
+
}
|
|
90
95
|
const hasContent = (msg) => Array.isArray(msg) && msg.length > 0;
|
|
91
96
|
if (options.maxWidth != null) {
|
|
92
97
|
const hasEntries = page.sections.some((s) => s.entries.length > 0);
|
package/dist/doc.d.cts
CHANGED
|
@@ -148,9 +148,10 @@ interface ShowChoicesOptions {
|
|
|
148
148
|
readonly label?: string;
|
|
149
149
|
/**
|
|
150
150
|
* Maximum number of choice values to display before truncating with
|
|
151
|
-
* `...`. Set to `Infinity` to show all choices.
|
|
151
|
+
* `...`. Must be at least `1`. Set to `Infinity` to show all choices.
|
|
152
152
|
*
|
|
153
153
|
* @default `8`
|
|
154
|
+
* @throws {RangeError} If the value is less than `1`.
|
|
154
155
|
*/
|
|
155
156
|
readonly maxItems?: number;
|
|
156
157
|
}
|
|
@@ -267,7 +268,8 @@ interface DocPageFormatOptions {
|
|
|
267
268
|
* any non-empty section's title is empty, whitespace-only, or contains a CR
|
|
268
269
|
* or LF character, or if `maxWidth` is not a finite integer.
|
|
269
270
|
* @throws {RangeError} If any entry needs a description column and `maxWidth`
|
|
270
|
-
* is too small to fit the minimum layout (less than `termIndent + 4`)
|
|
271
|
+
* is too small to fit the minimum layout (less than `termIndent + 4`), or if
|
|
272
|
+
* `showChoices.maxItems` is less than `1`.
|
|
271
273
|
*
|
|
272
274
|
* @example
|
|
273
275
|
* ```typescript
|
package/dist/doc.d.ts
CHANGED
|
@@ -148,9 +148,10 @@ interface ShowChoicesOptions {
|
|
|
148
148
|
readonly label?: string;
|
|
149
149
|
/**
|
|
150
150
|
* Maximum number of choice values to display before truncating with
|
|
151
|
-
* `...`. Set to `Infinity` to show all choices.
|
|
151
|
+
* `...`. Must be at least `1`. Set to `Infinity` to show all choices.
|
|
152
152
|
*
|
|
153
153
|
* @default `8`
|
|
154
|
+
* @throws {RangeError} If the value is less than `1`.
|
|
154
155
|
*/
|
|
155
156
|
readonly maxItems?: number;
|
|
156
157
|
}
|
|
@@ -267,7 +268,8 @@ interface DocPageFormatOptions {
|
|
|
267
268
|
* any non-empty section's title is empty, whitespace-only, or contains a CR
|
|
268
269
|
* or LF character, or if `maxWidth` is not a finite integer.
|
|
269
270
|
* @throws {RangeError} If any entry needs a description column and `maxWidth`
|
|
270
|
-
* is too small to fit the minimum layout (less than `termIndent + 4`)
|
|
271
|
+
* is too small to fit the minimum layout (less than `termIndent + 4`), or if
|
|
272
|
+
* `showChoices.maxItems` is less than `1`.
|
|
271
273
|
*
|
|
272
274
|
* @example
|
|
273
275
|
* ```typescript
|
package/dist/doc.js
CHANGED
|
@@ -51,7 +51,8 @@ function defaultSectionOrder(a, b) {
|
|
|
51
51
|
* any non-empty section's title is empty, whitespace-only, or contains a CR
|
|
52
52
|
* or LF character, or if `maxWidth` is not a finite integer.
|
|
53
53
|
* @throws {RangeError} If any entry needs a description column and `maxWidth`
|
|
54
|
-
* is too small to fit the minimum layout (less than `termIndent + 4`)
|
|
54
|
+
* is too small to fit the minimum layout (less than `termIndent + 4`), or if
|
|
55
|
+
* `showChoices.maxItems` is less than `1`.
|
|
55
56
|
*
|
|
56
57
|
* @example
|
|
57
58
|
* ```typescript
|
|
@@ -87,6 +88,10 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
87
88
|
...page,
|
|
88
89
|
sections: filteredSections
|
|
89
90
|
};
|
|
91
|
+
if (typeof options.showChoices === "object" && options.showChoices.maxItems != null) {
|
|
92
|
+
const maxItems = options.showChoices.maxItems;
|
|
93
|
+
if (maxItems < 1) throw new RangeError(`showChoices.maxItems must be at least 1, but got ${maxItems}.`);
|
|
94
|
+
}
|
|
90
95
|
const hasContent = (msg) => Array.isArray(msg) && msg.length > 0;
|
|
91
96
|
if (options.maxWidth != null) {
|
|
92
97
|
const hasEntries = page.sections.some((s) => s.entries.length > 0);
|
package/dist/modifiers.cjs
CHANGED
|
@@ -628,7 +628,7 @@ function multiple(parser, options = {}) {
|
|
|
628
628
|
suggestion.type,
|
|
629
629
|
suggestion.pattern ?? "",
|
|
630
630
|
suggestion.includeHidden === true,
|
|
631
|
-
suggestion.extensions == null ? "" : suggestion.extensions.join("\0"),
|
|
631
|
+
suggestion.extensions == null ? "" : suggestion.extensions.toSorted().join("\0"),
|
|
632
632
|
description
|
|
633
633
|
]);
|
|
634
634
|
};
|
package/dist/modifiers.js
CHANGED
|
@@ -628,7 +628,7 @@ function multiple(parser, options = {}) {
|
|
|
628
628
|
suggestion.type,
|
|
629
629
|
suggestion.pattern ?? "",
|
|
630
630
|
suggestion.includeHidden === true,
|
|
631
|
-
suggestion.extensions == null ? "" : suggestion.extensions.join("\0"),
|
|
631
|
+
suggestion.extensions == null ? "" : suggestion.extensions.toSorted().join("\0"),
|
|
632
632
|
description
|
|
633
633
|
]);
|
|
634
634
|
};
|
package/dist/suggestion.cjs
CHANGED
|
@@ -192,7 +192,7 @@ function createErrorWithSuggestions(baseError, invalidInput, usage, type = "both
|
|
|
192
192
|
*/
|
|
193
193
|
function getSuggestionKey(suggestion) {
|
|
194
194
|
if (suggestion.kind === "literal") return suggestion.text;
|
|
195
|
-
return `__FILE__:${suggestion.type}:${suggestion.extensions?.join(",") ?? ""}:${suggestion.pattern ?? ""}`;
|
|
195
|
+
return `__FILE__:${suggestion.type}:${suggestion.extensions?.toSorted().join(",") ?? ""}:${suggestion.pattern ?? ""}`;
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
198
|
* Removes duplicate suggestions from an array while preserving order.
|
package/dist/suggestion.js
CHANGED
|
@@ -192,7 +192,7 @@ function createErrorWithSuggestions(baseError, invalidInput, usage, type = "both
|
|
|
192
192
|
*/
|
|
193
193
|
function getSuggestionKey(suggestion) {
|
|
194
194
|
if (suggestion.kind === "literal") return suggestion.text;
|
|
195
|
-
return `__FILE__:${suggestion.type}:${suggestion.extensions?.join(",") ?? ""}:${suggestion.pattern ?? ""}`;
|
|
195
|
+
return `__FILE__:${suggestion.type}:${suggestion.extensions?.toSorted().join(",") ?? ""}:${suggestion.pattern ?? ""}`;
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
198
|
* Removes duplicate suggestions from an array while preserving order.
|