@optique/core 1.4.0-dev.2630 → 1.4.0-dev.2633
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 +77 -7
- package/dist/doc.d.cts +42 -1
- package/dist/doc.d.ts +42 -1
- package/dist/doc.js +78 -9
- package/dist/facade.cjs +3 -1
- package/dist/facade.d.cts +7 -1
- package/dist/facade.d.ts +7 -1
- package/dist/facade.js +3 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/terminal-internal.cjs +2 -1
- package/dist/terminal-internal.js +2 -1
- package/dist/terminal.d.cts +2 -0
- package/dist/terminal.d.ts +2 -0
- package/package.json +2 -2
- package/skills/optique/SKILL.md +2 -2
package/dist/doc.cjs
CHANGED
|
@@ -138,12 +138,58 @@ function deduplicateDocFragments(fragments) {
|
|
|
138
138
|
function cloneDocEntry(entry) {
|
|
139
139
|
return {
|
|
140
140
|
term: require_usage.cloneUsageTerm(entry.term),
|
|
141
|
+
...entry.envVars != null && { envVars: [...entry.envVars] },
|
|
141
142
|
...entry.description != null && { description: require_message.cloneMessage(entry.description) },
|
|
142
143
|
...entry.default != null && { default: require_message.cloneMessage(entry.default) },
|
|
143
144
|
...entry.choices != null && { choices: require_message.cloneMessage(entry.choices) }
|
|
144
145
|
};
|
|
145
146
|
}
|
|
146
147
|
/**
|
|
148
|
+
* Derives an environment section from the visible entries on a help page.
|
|
149
|
+
* Names are grouped in first-appearance order with references to their
|
|
150
|
+
* associated entries. Empty names and hidden or empty terms are ignored.
|
|
151
|
+
* This does not read environment values or modify the page. Entries without
|
|
152
|
+
* CLI documentation, such as `bindEnv(fail(), ...)`, are not collected.
|
|
153
|
+
*
|
|
154
|
+
* @param page The documentation page to inspect.
|
|
155
|
+
* @param options An optional heading for the generated section.
|
|
156
|
+
* @returns A new section, or `undefined` when there are no visible names.
|
|
157
|
+
* @throws {TypeError} If a used title is empty or contains control characters.
|
|
158
|
+
* @since 1.4.0
|
|
159
|
+
*/
|
|
160
|
+
function deriveEnvironmentSection(page, options = {}) {
|
|
161
|
+
const bindings = /* @__PURE__ */ new Map();
|
|
162
|
+
for (const section of page.sections) for (const entry of section.entries) {
|
|
163
|
+
if (isDocEntryHidden(entry)) continue;
|
|
164
|
+
const rendered = require_usage.formatUsageTerm(entry.term, { context: "doc" });
|
|
165
|
+
if (rendered.trim() === "") continue;
|
|
166
|
+
const term = entry.term;
|
|
167
|
+
const reference = term.type === "option" ? [require_message.optionNames(term.names), ...term.metavar == null ? [] : [require_message.text(" "), require_message.metavar(term.metavar)]] : term.type === "argument" ? [require_message.metavar(term.metavar)] : term.type === "command" ? [require_message.commandLine(term.name)] : [require_message.text(rendered)];
|
|
168
|
+
for (const name of entry.envVars ?? []) {
|
|
169
|
+
if (name === "") continue;
|
|
170
|
+
let references = bindings.get(name);
|
|
171
|
+
if (references == null) {
|
|
172
|
+
references = /* @__PURE__ */ new Map();
|
|
173
|
+
bindings.set(name, references);
|
|
174
|
+
}
|
|
175
|
+
references.set(rendered, reference);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (bindings.size === 0) return void 0;
|
|
179
|
+
const title = options.title ?? "Environment";
|
|
180
|
+
require_validate.validateLabel(title);
|
|
181
|
+
return {
|
|
182
|
+
title,
|
|
183
|
+
entries: Array.from(bindings, ([name, references]) => ({
|
|
184
|
+
term: {
|
|
185
|
+
type: "literal",
|
|
186
|
+
value: name
|
|
187
|
+
},
|
|
188
|
+
description: Array.from(references.values()).flatMap((reference, i) => i === 0 ? reference : [require_message.text(", "), ...reference])
|
|
189
|
+
}))
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
147
193
|
* Classifies a {@link DocSection} by its content type for use in the
|
|
148
194
|
* default smart sort.
|
|
149
195
|
*
|
|
@@ -224,6 +270,11 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
224
270
|
const opaqueFormatter = options.messageFormatter != null && !require_message_registry.messageRenderers.has(options.messageFormatter);
|
|
225
271
|
const defaultAmbient = options.theme?.annotationStyles?.default ?? { dim: true };
|
|
226
272
|
const choicesAmbient = options.theme?.annotationStyles?.choices ?? { dim: true };
|
|
273
|
+
const environmentAmbient = options.theme?.annotationStyles?.environment ?? { dim: true };
|
|
274
|
+
const environmentStyle = require_terminal_internal.styleCode(environmentAmbient);
|
|
275
|
+
const environmentPlacement = typeof options.showEnvironment === "object" ? options.showEnvironment.placement ?? "inline" : options.showEnvironment ? "inline" : void 0;
|
|
276
|
+
const showInlineEnvironment = environmentPlacement === "inline" || environmentPlacement === "both";
|
|
277
|
+
const environmentContent = (entry) => [...new Set(entry.envVars ?? [])].filter((name) => name !== "").flatMap((name, i) => i === 0 ? [require_message.envVar(name)] : [require_message.text(", "), require_message.envVar(name)]);
|
|
227
278
|
const labelCache = /* @__PURE__ */ new Map();
|
|
228
279
|
const label = (label$1, kind) => {
|
|
229
280
|
const key = `${kind}:${label$1}`;
|
|
@@ -267,20 +318,29 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
267
318
|
return rendered.trim() !== "";
|
|
268
319
|
})
|
|
269
320
|
}));
|
|
270
|
-
|
|
321
|
+
const environmentSection = environmentPlacement === "section" || environmentPlacement === "both" ? deriveEnvironmentSection({
|
|
271
322
|
...page,
|
|
272
323
|
sections: filteredSections
|
|
324
|
+
}, { title: typeof options.showEnvironment === "object" ? options.showEnvironment.sectionTitle : void 0 }) : void 0;
|
|
325
|
+
page = {
|
|
326
|
+
...page,
|
|
327
|
+
sections: environmentSection == null ? filteredSections : [...filteredSections, environmentSection]
|
|
273
328
|
};
|
|
274
329
|
if (typeof options.showChoices === "object" && options.showChoices.maxItems != null) {
|
|
275
330
|
const maxItems = options.showChoices.maxItems;
|
|
276
331
|
if (maxItems < 1) throw new RangeError(`showChoices.maxItems must be at least 1, but got ${maxItems}.`);
|
|
277
332
|
}
|
|
278
333
|
const hasContent = (msg) => Array.isArray(msg) && msg.length > 0;
|
|
279
|
-
const needsDescriptionColumn = (entry) => hasContent(entry.description) || (options.showDefault === true || typeof options.showDefault === "object") && hasContent(entry.default) || (options.showChoices === true || typeof options.showChoices === "object") && hasContent(entry.choices);
|
|
334
|
+
const needsDescriptionColumn = (entry) => hasContent(entry.description) || (options.showDefault === true || typeof options.showDefault === "object") && hasContent(entry.default) || (options.showChoices === true || typeof options.showChoices === "object") && hasContent(entry.choices) || showInlineEnvironment && hasContent(environmentContent(entry));
|
|
280
335
|
const annotations = /* @__PURE__ */ new Map();
|
|
281
336
|
const annotation = (kind) => {
|
|
282
337
|
const cached = annotations.get(kind);
|
|
283
338
|
if (cached != null) return cached;
|
|
339
|
+
if (kind === "environment") {
|
|
340
|
+
const layout$1 = require_text_layout.measureAnnotation(" [env: ", "]");
|
|
341
|
+
annotations.set(kind, layout$1);
|
|
342
|
+
return layout$1;
|
|
343
|
+
}
|
|
284
344
|
const config = kind === "default" ? options.showDefault : options.showChoices;
|
|
285
345
|
const prefix = punctuation(typeof config === "object" ? config.prefix ?? (kind === "default" ? " [" : " (") : kind === "default" ? " [" : " (", kind === "default" ? "defaultPrefix" : "choicesPrefix");
|
|
286
346
|
const suffix = punctuation(typeof config === "object" ? config.suffix ?? (kind === "default" ? "]" : ")") : kind === "default" ? "]" : ")", kind === "default" ? "defaultSuffix" : "choicesSuffix");
|
|
@@ -316,9 +376,13 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
316
376
|
}
|
|
317
377
|
if (options.maxWidth != null) {
|
|
318
378
|
let minDescWidth = 1;
|
|
319
|
-
if (needsDescColumn) for (const kind of [
|
|
320
|
-
|
|
321
|
-
|
|
379
|
+
if (needsDescColumn) for (const kind of [
|
|
380
|
+
"default",
|
|
381
|
+
"choices",
|
|
382
|
+
"environment"
|
|
383
|
+
]) {
|
|
384
|
+
const enabled = kind === "default" ? options.showDefault : kind === "choices" ? options.showChoices : showInlineEnvironment;
|
|
385
|
+
if (enabled && page.sections.some((section) => section.entries.some((entry) => hasContent(kind === "environment" ? environmentContent(entry) : entry[kind])))) minDescWidth = Math.max(minDescWidth, annotation(kind).minWidth);
|
|
322
386
|
}
|
|
323
387
|
const splitEntryMin = termIndent + 2 + Math.max(2, 2 * minDescWidth - 1);
|
|
324
388
|
const fixedEntryMin = termIndent + 2 + termWidth + minDescWidth;
|
|
@@ -387,7 +451,7 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
387
451
|
output += "\n";
|
|
388
452
|
}
|
|
389
453
|
const comparator = options.sectionOrder ?? defaultSectionOrder;
|
|
390
|
-
const sections =
|
|
454
|
+
const sections = filteredSections.map((s, i) => ({
|
|
391
455
|
section: s,
|
|
392
456
|
index: i
|
|
393
457
|
})).toSorted((a, b) => {
|
|
@@ -395,6 +459,7 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
395
459
|
if (cmp !== 0) return cmp;
|
|
396
460
|
return a.index - b.index;
|
|
397
461
|
}).map(({ section }) => section);
|
|
462
|
+
if (environmentSection != null) sections.push(environmentSection);
|
|
398
463
|
for (const section of sections) {
|
|
399
464
|
if (section.entries.length < 1) continue;
|
|
400
465
|
output += "\n";
|
|
@@ -421,7 +486,7 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
421
486
|
const extraTermOffset = descColumnWidth != null ? Math.max(0, termVisibleWidth - effectiveTermWidth) : 0;
|
|
422
487
|
const descFormatOptions = {
|
|
423
488
|
colors: options.colors,
|
|
424
|
-
quotes: !options.colors,
|
|
489
|
+
quotes: section === environmentSection ? false : !options.colors,
|
|
425
490
|
maxWidth: descColumnWidth,
|
|
426
491
|
initialWidth: extraTermOffset > 0 ? extraTermOffset : void 0
|
|
427
492
|
};
|
|
@@ -465,6 +530,10 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
465
530
|
}
|
|
466
531
|
appendAnnotation(truncatedTerms, annotation("choices"), choicesStyle, choicesAmbient, false);
|
|
467
532
|
}
|
|
533
|
+
if (showInlineEnvironment) {
|
|
534
|
+
const content = environmentContent(entry);
|
|
535
|
+
if (hasContent(content)) appendAnnotation(content, annotation("environment"), environmentStyle, environmentAmbient, false);
|
|
536
|
+
}
|
|
468
537
|
const paddedTerm = ansiAwareRightPad(term, effectiveTermWidth);
|
|
469
538
|
output += `${" ".repeat(termIndent)}${multilineReplacement ? indentLines(paddedTerm, termIndent) : paddedTerm}${description === "" ? "" : ` ${indentLines(description, termIndent + effectiveTermWidth + 2)}`}\n`;
|
|
470
539
|
}
|
|
@@ -528,5 +597,6 @@ function ansiAwareRightPad(text$1, length, char = " ") {
|
|
|
528
597
|
exports.cloneDocEntry = cloneDocEntry;
|
|
529
598
|
exports.deduplicateDocEntries = deduplicateDocEntries;
|
|
530
599
|
exports.deduplicateDocFragments = deduplicateDocFragments;
|
|
600
|
+
exports.deriveEnvironmentSection = deriveEnvironmentSection;
|
|
531
601
|
exports.formatDocPage = formatDocPage;
|
|
532
602
|
exports.isDocEntryHidden = isDocEntryHidden;
|
package/dist/doc.d.cts
CHANGED
|
@@ -34,6 +34,13 @@ interface DocEntry {
|
|
|
34
34
|
* @since 0.10.0
|
|
35
35
|
*/
|
|
36
36
|
readonly choices?: Message;
|
|
37
|
+
/**
|
|
38
|
+
* Declared environment bindings associated with this entry, outermost
|
|
39
|
+
* first. These names do not guarantee that every binding is consulted
|
|
40
|
+
* during parsing. Renderers can display them with `showEnvironment`.
|
|
41
|
+
* @since 1.4.0
|
|
42
|
+
*/
|
|
43
|
+
readonly envVars?: readonly string[];
|
|
37
44
|
}
|
|
38
45
|
/**
|
|
39
46
|
* A section in a document that groups related entries together.
|
|
@@ -151,6 +158,32 @@ declare function deduplicateDocFragments(fragments: readonly DocFragment[]): Doc
|
|
|
151
158
|
* @since 1.0.0
|
|
152
159
|
*/
|
|
153
160
|
declare function cloneDocEntry(entry: DocEntry): DocEntry;
|
|
161
|
+
/**
|
|
162
|
+
* Controls automatic environment documentation in help and man pages.
|
|
163
|
+
* @since 1.4.0
|
|
164
|
+
*/
|
|
165
|
+
interface ShowEnvironmentOptions {
|
|
166
|
+
/** The display layout. Defaults to `"inline"`. */
|
|
167
|
+
readonly placement?: "inline" | "section" | "both";
|
|
168
|
+
/** The generated section's heading. Defaults to `"Environment"`. */
|
|
169
|
+
readonly sectionTitle?: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Derives an environment section from the visible entries on a help page.
|
|
173
|
+
* Names are grouped in first-appearance order with references to their
|
|
174
|
+
* associated entries. Empty names and hidden or empty terms are ignored.
|
|
175
|
+
* This does not read environment values or modify the page. Entries without
|
|
176
|
+
* CLI documentation, such as `bindEnv(fail(), ...)`, are not collected.
|
|
177
|
+
*
|
|
178
|
+
* @param page The documentation page to inspect.
|
|
179
|
+
* @param options An optional heading for the generated section.
|
|
180
|
+
* @returns A new section, or `undefined` when there are no visible names.
|
|
181
|
+
* @throws {TypeError} If a used title is empty or contains control characters.
|
|
182
|
+
* @since 1.4.0
|
|
183
|
+
*/
|
|
184
|
+
declare function deriveEnvironmentSection(page: DocPage, options?: {
|
|
185
|
+
readonly title?: string;
|
|
186
|
+
}): DocSection | undefined;
|
|
154
187
|
/**
|
|
155
188
|
* Configuration for customizing default value display formatting.
|
|
156
189
|
*
|
|
@@ -207,6 +240,14 @@ interface ShowChoicesOptions {
|
|
|
207
240
|
* Options for formatting a documentation page.
|
|
208
241
|
*/
|
|
209
242
|
interface DocPageFormatOptions {
|
|
243
|
+
/**
|
|
244
|
+
* Displays declared environment bindings. `true` or `{}` selects inline
|
|
245
|
+
* annotations; `placement` can select a section or both. Defaults to `false`.
|
|
246
|
+
* Generated sections follow the regular sections, before examples, and are
|
|
247
|
+
* not passed to `sectionOrder`. The original page is not modified.
|
|
248
|
+
* @since 1.4.0
|
|
249
|
+
*/
|
|
250
|
+
readonly showEnvironment?: boolean | ShowEnvironmentOptions;
|
|
210
251
|
/**
|
|
211
252
|
* Custom message renderer, taking precedence over theme for messages.
|
|
212
253
|
* @since 1.3.0
|
|
@@ -362,4 +403,4 @@ interface DocPageFormatOptions {
|
|
|
362
403
|
*/
|
|
363
404
|
declare function formatDocPage(programName: string, page: DocPage, options?: DocPageFormatOptions): string;
|
|
364
405
|
//#endregion
|
|
365
|
-
export { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage, isDocEntryHidden };
|
|
406
|
+
export { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, ShowEnvironmentOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, deriveEnvironmentSection, formatDocPage, isDocEntryHidden };
|
package/dist/doc.d.ts
CHANGED
|
@@ -34,6 +34,13 @@ interface DocEntry {
|
|
|
34
34
|
* @since 0.10.0
|
|
35
35
|
*/
|
|
36
36
|
readonly choices?: Message;
|
|
37
|
+
/**
|
|
38
|
+
* Declared environment bindings associated with this entry, outermost
|
|
39
|
+
* first. These names do not guarantee that every binding is consulted
|
|
40
|
+
* during parsing. Renderers can display them with `showEnvironment`.
|
|
41
|
+
* @since 1.4.0
|
|
42
|
+
*/
|
|
43
|
+
readonly envVars?: readonly string[];
|
|
37
44
|
}
|
|
38
45
|
/**
|
|
39
46
|
* A section in a document that groups related entries together.
|
|
@@ -151,6 +158,32 @@ declare function deduplicateDocFragments(fragments: readonly DocFragment[]): Doc
|
|
|
151
158
|
* @since 1.0.0
|
|
152
159
|
*/
|
|
153
160
|
declare function cloneDocEntry(entry: DocEntry): DocEntry;
|
|
161
|
+
/**
|
|
162
|
+
* Controls automatic environment documentation in help and man pages.
|
|
163
|
+
* @since 1.4.0
|
|
164
|
+
*/
|
|
165
|
+
interface ShowEnvironmentOptions {
|
|
166
|
+
/** The display layout. Defaults to `"inline"`. */
|
|
167
|
+
readonly placement?: "inline" | "section" | "both";
|
|
168
|
+
/** The generated section's heading. Defaults to `"Environment"`. */
|
|
169
|
+
readonly sectionTitle?: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Derives an environment section from the visible entries on a help page.
|
|
173
|
+
* Names are grouped in first-appearance order with references to their
|
|
174
|
+
* associated entries. Empty names and hidden or empty terms are ignored.
|
|
175
|
+
* This does not read environment values or modify the page. Entries without
|
|
176
|
+
* CLI documentation, such as `bindEnv(fail(), ...)`, are not collected.
|
|
177
|
+
*
|
|
178
|
+
* @param page The documentation page to inspect.
|
|
179
|
+
* @param options An optional heading for the generated section.
|
|
180
|
+
* @returns A new section, or `undefined` when there are no visible names.
|
|
181
|
+
* @throws {TypeError} If a used title is empty or contains control characters.
|
|
182
|
+
* @since 1.4.0
|
|
183
|
+
*/
|
|
184
|
+
declare function deriveEnvironmentSection(page: DocPage, options?: {
|
|
185
|
+
readonly title?: string;
|
|
186
|
+
}): DocSection | undefined;
|
|
154
187
|
/**
|
|
155
188
|
* Configuration for customizing default value display formatting.
|
|
156
189
|
*
|
|
@@ -207,6 +240,14 @@ interface ShowChoicesOptions {
|
|
|
207
240
|
* Options for formatting a documentation page.
|
|
208
241
|
*/
|
|
209
242
|
interface DocPageFormatOptions {
|
|
243
|
+
/**
|
|
244
|
+
* Displays declared environment bindings. `true` or `{}` selects inline
|
|
245
|
+
* annotations; `placement` can select a section or both. Defaults to `false`.
|
|
246
|
+
* Generated sections follow the regular sections, before examples, and are
|
|
247
|
+
* not passed to `sectionOrder`. The original page is not modified.
|
|
248
|
+
* @since 1.4.0
|
|
249
|
+
*/
|
|
250
|
+
readonly showEnvironment?: boolean | ShowEnvironmentOptions;
|
|
210
251
|
/**
|
|
211
252
|
* Custom message renderer, taking precedence over theme for messages.
|
|
212
253
|
* @since 1.3.0
|
|
@@ -362,4 +403,4 @@ interface DocPageFormatOptions {
|
|
|
362
403
|
*/
|
|
363
404
|
declare function formatDocPage(programName: string, page: DocPage, options?: DocPageFormatOptions): string;
|
|
364
405
|
//#endregion
|
|
365
|
-
export { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage, isDocEntryHidden };
|
|
406
|
+
export { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, ShowEnvironmentOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, deriveEnvironmentSection, formatDocPage, isDocEntryHidden };
|
package/dist/doc.js
CHANGED
|
@@ -4,7 +4,7 @@ import { validateLabel, validateProgramName } from "./validate.js";
|
|
|
4
4
|
import { cloneUsageTerm, formatUsage, formatUsageTerm, isDocHidden } from "./usage.js";
|
|
5
5
|
import { hasAutomaticWidth, minimumUsageWidth, reportAutomaticWidth } from "./terminal-width.js";
|
|
6
6
|
import { messageRenderers } from "./message-registry.js";
|
|
7
|
-
import { cloneMessage, text } from "./message.js";
|
|
7
|
+
import { cloneMessage, commandLine, envVar, metavar, optionNames, text } from "./message.js";
|
|
8
8
|
import { resolveMessageFormatter } from "./message-renderer.js";
|
|
9
9
|
|
|
10
10
|
//#region src/doc.ts
|
|
@@ -138,12 +138,58 @@ function deduplicateDocFragments(fragments) {
|
|
|
138
138
|
function cloneDocEntry(entry) {
|
|
139
139
|
return {
|
|
140
140
|
term: cloneUsageTerm(entry.term),
|
|
141
|
+
...entry.envVars != null && { envVars: [...entry.envVars] },
|
|
141
142
|
...entry.description != null && { description: cloneMessage(entry.description) },
|
|
142
143
|
...entry.default != null && { default: cloneMessage(entry.default) },
|
|
143
144
|
...entry.choices != null && { choices: cloneMessage(entry.choices) }
|
|
144
145
|
};
|
|
145
146
|
}
|
|
146
147
|
/**
|
|
148
|
+
* Derives an environment section from the visible entries on a help page.
|
|
149
|
+
* Names are grouped in first-appearance order with references to their
|
|
150
|
+
* associated entries. Empty names and hidden or empty terms are ignored.
|
|
151
|
+
* This does not read environment values or modify the page. Entries without
|
|
152
|
+
* CLI documentation, such as `bindEnv(fail(), ...)`, are not collected.
|
|
153
|
+
*
|
|
154
|
+
* @param page The documentation page to inspect.
|
|
155
|
+
* @param options An optional heading for the generated section.
|
|
156
|
+
* @returns A new section, or `undefined` when there are no visible names.
|
|
157
|
+
* @throws {TypeError} If a used title is empty or contains control characters.
|
|
158
|
+
* @since 1.4.0
|
|
159
|
+
*/
|
|
160
|
+
function deriveEnvironmentSection(page, options = {}) {
|
|
161
|
+
const bindings = /* @__PURE__ */ new Map();
|
|
162
|
+
for (const section of page.sections) for (const entry of section.entries) {
|
|
163
|
+
if (isDocEntryHidden(entry)) continue;
|
|
164
|
+
const rendered = formatUsageTerm(entry.term, { context: "doc" });
|
|
165
|
+
if (rendered.trim() === "") continue;
|
|
166
|
+
const term = entry.term;
|
|
167
|
+
const reference = term.type === "option" ? [optionNames(term.names), ...term.metavar == null ? [] : [text(" "), metavar(term.metavar)]] : term.type === "argument" ? [metavar(term.metavar)] : term.type === "command" ? [commandLine(term.name)] : [text(rendered)];
|
|
168
|
+
for (const name of entry.envVars ?? []) {
|
|
169
|
+
if (name === "") continue;
|
|
170
|
+
let references = bindings.get(name);
|
|
171
|
+
if (references == null) {
|
|
172
|
+
references = /* @__PURE__ */ new Map();
|
|
173
|
+
bindings.set(name, references);
|
|
174
|
+
}
|
|
175
|
+
references.set(rendered, reference);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (bindings.size === 0) return void 0;
|
|
179
|
+
const title = options.title ?? "Environment";
|
|
180
|
+
validateLabel(title);
|
|
181
|
+
return {
|
|
182
|
+
title,
|
|
183
|
+
entries: Array.from(bindings, ([name, references]) => ({
|
|
184
|
+
term: {
|
|
185
|
+
type: "literal",
|
|
186
|
+
value: name
|
|
187
|
+
},
|
|
188
|
+
description: Array.from(references.values()).flatMap((reference, i) => i === 0 ? reference : [text(", "), ...reference])
|
|
189
|
+
}))
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
147
193
|
* Classifies a {@link DocSection} by its content type for use in the
|
|
148
194
|
* default smart sort.
|
|
149
195
|
*
|
|
@@ -224,6 +270,11 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
224
270
|
const opaqueFormatter = options.messageFormatter != null && !messageRenderers.has(options.messageFormatter);
|
|
225
271
|
const defaultAmbient = options.theme?.annotationStyles?.default ?? { dim: true };
|
|
226
272
|
const choicesAmbient = options.theme?.annotationStyles?.choices ?? { dim: true };
|
|
273
|
+
const environmentAmbient = options.theme?.annotationStyles?.environment ?? { dim: true };
|
|
274
|
+
const environmentStyle = styleCode(environmentAmbient);
|
|
275
|
+
const environmentPlacement = typeof options.showEnvironment === "object" ? options.showEnvironment.placement ?? "inline" : options.showEnvironment ? "inline" : void 0;
|
|
276
|
+
const showInlineEnvironment = environmentPlacement === "inline" || environmentPlacement === "both";
|
|
277
|
+
const environmentContent = (entry) => [...new Set(entry.envVars ?? [])].filter((name) => name !== "").flatMap((name, i) => i === 0 ? [envVar(name)] : [text(", "), envVar(name)]);
|
|
227
278
|
const labelCache = /* @__PURE__ */ new Map();
|
|
228
279
|
const label = (label$1, kind) => {
|
|
229
280
|
const key = `${kind}:${label$1}`;
|
|
@@ -267,20 +318,29 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
267
318
|
return rendered.trim() !== "";
|
|
268
319
|
})
|
|
269
320
|
}));
|
|
270
|
-
|
|
321
|
+
const environmentSection = environmentPlacement === "section" || environmentPlacement === "both" ? deriveEnvironmentSection({
|
|
271
322
|
...page,
|
|
272
323
|
sections: filteredSections
|
|
324
|
+
}, { title: typeof options.showEnvironment === "object" ? options.showEnvironment.sectionTitle : void 0 }) : void 0;
|
|
325
|
+
page = {
|
|
326
|
+
...page,
|
|
327
|
+
sections: environmentSection == null ? filteredSections : [...filteredSections, environmentSection]
|
|
273
328
|
};
|
|
274
329
|
if (typeof options.showChoices === "object" && options.showChoices.maxItems != null) {
|
|
275
330
|
const maxItems = options.showChoices.maxItems;
|
|
276
331
|
if (maxItems < 1) throw new RangeError(`showChoices.maxItems must be at least 1, but got ${maxItems}.`);
|
|
277
332
|
}
|
|
278
333
|
const hasContent = (msg) => Array.isArray(msg) && msg.length > 0;
|
|
279
|
-
const needsDescriptionColumn = (entry) => hasContent(entry.description) || (options.showDefault === true || typeof options.showDefault === "object") && hasContent(entry.default) || (options.showChoices === true || typeof options.showChoices === "object") && hasContent(entry.choices);
|
|
334
|
+
const needsDescriptionColumn = (entry) => hasContent(entry.description) || (options.showDefault === true || typeof options.showDefault === "object") && hasContent(entry.default) || (options.showChoices === true || typeof options.showChoices === "object") && hasContent(entry.choices) || showInlineEnvironment && hasContent(environmentContent(entry));
|
|
280
335
|
const annotations = /* @__PURE__ */ new Map();
|
|
281
336
|
const annotation = (kind) => {
|
|
282
337
|
const cached = annotations.get(kind);
|
|
283
338
|
if (cached != null) return cached;
|
|
339
|
+
if (kind === "environment") {
|
|
340
|
+
const layout$1 = measureAnnotation(" [env: ", "]");
|
|
341
|
+
annotations.set(kind, layout$1);
|
|
342
|
+
return layout$1;
|
|
343
|
+
}
|
|
284
344
|
const config = kind === "default" ? options.showDefault : options.showChoices;
|
|
285
345
|
const prefix = punctuation(typeof config === "object" ? config.prefix ?? (kind === "default" ? " [" : " (") : kind === "default" ? " [" : " (", kind === "default" ? "defaultPrefix" : "choicesPrefix");
|
|
286
346
|
const suffix = punctuation(typeof config === "object" ? config.suffix ?? (kind === "default" ? "]" : ")") : kind === "default" ? "]" : ")", kind === "default" ? "defaultSuffix" : "choicesSuffix");
|
|
@@ -316,9 +376,13 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
316
376
|
}
|
|
317
377
|
if (options.maxWidth != null) {
|
|
318
378
|
let minDescWidth = 1;
|
|
319
|
-
if (needsDescColumn) for (const kind of [
|
|
320
|
-
|
|
321
|
-
|
|
379
|
+
if (needsDescColumn) for (const kind of [
|
|
380
|
+
"default",
|
|
381
|
+
"choices",
|
|
382
|
+
"environment"
|
|
383
|
+
]) {
|
|
384
|
+
const enabled = kind === "default" ? options.showDefault : kind === "choices" ? options.showChoices : showInlineEnvironment;
|
|
385
|
+
if (enabled && page.sections.some((section) => section.entries.some((entry) => hasContent(kind === "environment" ? environmentContent(entry) : entry[kind])))) minDescWidth = Math.max(minDescWidth, annotation(kind).minWidth);
|
|
322
386
|
}
|
|
323
387
|
const splitEntryMin = termIndent + 2 + Math.max(2, 2 * minDescWidth - 1);
|
|
324
388
|
const fixedEntryMin = termIndent + 2 + termWidth + minDescWidth;
|
|
@@ -387,7 +451,7 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
387
451
|
output += "\n";
|
|
388
452
|
}
|
|
389
453
|
const comparator = options.sectionOrder ?? defaultSectionOrder;
|
|
390
|
-
const sections =
|
|
454
|
+
const sections = filteredSections.map((s, i) => ({
|
|
391
455
|
section: s,
|
|
392
456
|
index: i
|
|
393
457
|
})).toSorted((a, b) => {
|
|
@@ -395,6 +459,7 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
395
459
|
if (cmp !== 0) return cmp;
|
|
396
460
|
return a.index - b.index;
|
|
397
461
|
}).map(({ section }) => section);
|
|
462
|
+
if (environmentSection != null) sections.push(environmentSection);
|
|
398
463
|
for (const section of sections) {
|
|
399
464
|
if (section.entries.length < 1) continue;
|
|
400
465
|
output += "\n";
|
|
@@ -421,7 +486,7 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
421
486
|
const extraTermOffset = descColumnWidth != null ? Math.max(0, termVisibleWidth - effectiveTermWidth) : 0;
|
|
422
487
|
const descFormatOptions = {
|
|
423
488
|
colors: options.colors,
|
|
424
|
-
quotes: !options.colors,
|
|
489
|
+
quotes: section === environmentSection ? false : !options.colors,
|
|
425
490
|
maxWidth: descColumnWidth,
|
|
426
491
|
initialWidth: extraTermOffset > 0 ? extraTermOffset : void 0
|
|
427
492
|
};
|
|
@@ -465,6 +530,10 @@ function formatDocPage(programName, page, options = {}) {
|
|
|
465
530
|
}
|
|
466
531
|
appendAnnotation(truncatedTerms, annotation("choices"), choicesStyle, choicesAmbient, false);
|
|
467
532
|
}
|
|
533
|
+
if (showInlineEnvironment) {
|
|
534
|
+
const content = environmentContent(entry);
|
|
535
|
+
if (hasContent(content)) appendAnnotation(content, annotation("environment"), environmentStyle, environmentAmbient, false);
|
|
536
|
+
}
|
|
468
537
|
const paddedTerm = ansiAwareRightPad(term, effectiveTermWidth);
|
|
469
538
|
output += `${" ".repeat(termIndent)}${multilineReplacement ? indentLines(paddedTerm, termIndent) : paddedTerm}${description === "" ? "" : ` ${indentLines(description, termIndent + effectiveTermWidth + 2)}`}\n`;
|
|
470
539
|
}
|
|
@@ -525,4 +594,4 @@ function ansiAwareRightPad(text$1, length, char = " ") {
|
|
|
525
594
|
}
|
|
526
595
|
|
|
527
596
|
//#endregion
|
|
528
|
-
export { cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage, isDocEntryHidden };
|
|
597
|
+
export { cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, deriveEnvironmentSection, formatDocPage, isDocEntryHidden };
|
package/dist/facade.cjs
CHANGED
|
@@ -818,7 +818,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
818
818
|
options = optionsParam ?? {};
|
|
819
819
|
}
|
|
820
820
|
require_validate.validateProgramName(programName);
|
|
821
|
-
const { colors, messageFormatter, theme: requestedTheme, maxWidth: requestedMaxWidth, termWidth, showDefault, showChoices, sectionOrder, helpSections, showUsage, usageLine, commandList = "recursive", aboveError = "usage", onError = () => {
|
|
821
|
+
const { colors, messageFormatter, theme: requestedTheme, maxWidth: requestedMaxWidth, termWidth, showDefault, showChoices, showEnvironment, sectionOrder, helpSections, showUsage, usageLine, commandList = "recursive", aboveError = "usage", onError = () => {
|
|
822
822
|
throw new RunParserError("Failed to parse command line arguments.");
|
|
823
823
|
}, stderr = console.error, stdout = console.log, brief, description, examples, author, bugs, footer } = options;
|
|
824
824
|
let maxWidth = requestedMaxWidth;
|
|
@@ -1033,6 +1033,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1033
1033
|
termWidth,
|
|
1034
1034
|
showDefault,
|
|
1035
1035
|
showChoices,
|
|
1036
|
+
showEnvironment,
|
|
1036
1037
|
sectionOrder,
|
|
1037
1038
|
showUsage
|
|
1038
1039
|
})));
|
|
@@ -1110,6 +1111,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1110
1111
|
termWidth,
|
|
1111
1112
|
showDefault,
|
|
1112
1113
|
showChoices,
|
|
1114
|
+
showEnvironment,
|
|
1113
1115
|
sectionOrder,
|
|
1114
1116
|
showUsage
|
|
1115
1117
|
})));
|
package/dist/facade.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Message, MessageFormatter } from "./message.cjs";
|
|
2
2
|
import { TerminalTheme } from "./terminal.cjs";
|
|
3
3
|
import { HiddenVisibility, OptionName, Usage } from "./usage.cjs";
|
|
4
|
-
import { DocPage, DocSection, ShowChoicesOptions, ShowDefaultOptions } from "./doc.cjs";
|
|
4
|
+
import { DocPage, DocSection, ShowChoicesOptions, ShowDefaultOptions, ShowEnvironmentOptions } from "./doc.cjs";
|
|
5
5
|
import { InferMode, InferValue, Mode, ModeValue, Parser } from "./internal/parser.cjs";
|
|
6
6
|
import { ShellCompletion } from "./completion.cjs";
|
|
7
7
|
import { ParserValuePlaceholder, SourceContext, SourceContextRequest } from "./context.cjs";
|
|
@@ -148,6 +148,12 @@ interface RunOptions<THelp, TError> {
|
|
|
148
148
|
* @since 0.10.0
|
|
149
149
|
*/
|
|
150
150
|
readonly showChoices?: boolean | ShowChoicesOptions;
|
|
151
|
+
/**
|
|
152
|
+
* Displays declared environment bindings in help. `true` selects inline
|
|
153
|
+
* annotations; an object can select a section or both. Defaults to `false`.
|
|
154
|
+
* Also applies to full help above errors. @since 1.4.0
|
|
155
|
+
*/
|
|
156
|
+
readonly showEnvironment?: boolean | ShowEnvironmentOptions;
|
|
151
157
|
/**
|
|
152
158
|
* Whether to include the usage synopsis in full help output.
|
|
153
159
|
*
|
package/dist/facade.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Message, MessageFormatter } from "./message.js";
|
|
2
2
|
import { TerminalTheme } from "./terminal.js";
|
|
3
3
|
import { HiddenVisibility, OptionName, Usage } from "./usage.js";
|
|
4
|
-
import { DocPage, DocSection, ShowChoicesOptions, ShowDefaultOptions } from "./doc.js";
|
|
4
|
+
import { DocPage, DocSection, ShowChoicesOptions, ShowDefaultOptions, ShowEnvironmentOptions } from "./doc.js";
|
|
5
5
|
import { InferMode, InferValue, Mode, ModeValue, Parser } from "./internal/parser.js";
|
|
6
6
|
import { ShellCompletion } from "./completion.js";
|
|
7
7
|
import { ParserValuePlaceholder, SourceContext, SourceContextRequest } from "./context.js";
|
|
@@ -148,6 +148,12 @@ interface RunOptions<THelp, TError> {
|
|
|
148
148
|
* @since 0.10.0
|
|
149
149
|
*/
|
|
150
150
|
readonly showChoices?: boolean | ShowChoicesOptions;
|
|
151
|
+
/**
|
|
152
|
+
* Displays declared environment bindings in help. `true` selects inline
|
|
153
|
+
* annotations; an object can select a section or both. Defaults to `false`.
|
|
154
|
+
* Also applies to full help above errors. @since 1.4.0
|
|
155
|
+
*/
|
|
156
|
+
readonly showEnvironment?: boolean | ShowEnvironmentOptions;
|
|
151
157
|
/**
|
|
152
158
|
* Whether to include the usage synopsis in full help output.
|
|
153
159
|
*
|
package/dist/facade.js
CHANGED
|
@@ -818,7 +818,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
818
818
|
options = optionsParam ?? {};
|
|
819
819
|
}
|
|
820
820
|
validateProgramName(programName);
|
|
821
|
-
const { colors, messageFormatter, theme: requestedTheme, maxWidth: requestedMaxWidth, termWidth, showDefault, showChoices, sectionOrder, helpSections, showUsage, usageLine, commandList = "recursive", aboveError = "usage", onError = () => {
|
|
821
|
+
const { colors, messageFormatter, theme: requestedTheme, maxWidth: requestedMaxWidth, termWidth, showDefault, showChoices, showEnvironment, sectionOrder, helpSections, showUsage, usageLine, commandList = "recursive", aboveError = "usage", onError = () => {
|
|
822
822
|
throw new RunParserError("Failed to parse command line arguments.");
|
|
823
823
|
}, stderr = console.error, stdout = console.log, brief, description, examples, author, bugs, footer } = options;
|
|
824
824
|
let maxWidth = requestedMaxWidth;
|
|
@@ -1033,6 +1033,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1033
1033
|
termWidth,
|
|
1034
1034
|
showDefault,
|
|
1035
1035
|
showChoices,
|
|
1036
|
+
showEnvironment,
|
|
1036
1037
|
sectionOrder,
|
|
1037
1038
|
showUsage
|
|
1038
1039
|
})));
|
|
@@ -1110,6 +1111,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1110
1111
|
termWidth,
|
|
1111
1112
|
showDefault,
|
|
1112
1113
|
showChoices,
|
|
1114
|
+
showEnvironment,
|
|
1113
1115
|
sectionOrder,
|
|
1114
1116
|
showUsage
|
|
1115
1117
|
})));
|
package/dist/index.cjs
CHANGED
|
@@ -40,6 +40,7 @@ exports.deduplicateDocFragments = require_doc.deduplicateDocFragments;
|
|
|
40
40
|
exports.defaultTerminalTheme = require_terminal.defaultTerminalTheme;
|
|
41
41
|
exports.deferredValue = require_modifiers.deferredValue;
|
|
42
42
|
exports.dependency = require_internal_dependency.dependency;
|
|
43
|
+
exports.deriveEnvironmentSection = require_doc.deriveEnvironmentSection;
|
|
43
44
|
exports.deriveFrom = require_internal_dependency.deriveFrom;
|
|
44
45
|
exports.deriveFromAsync = require_internal_dependency.deriveFromAsync;
|
|
45
46
|
exports.deriveFromSync = require_internal_dependency.deriveFromSync;
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { NonEmptyString, ensureNonEmptyString, isNonEmptyString } from "./nonemp
|
|
|
3
3
|
import { Message, MessageFormatOptions, MessageFormatter, MessageFormatterOptions, MessageTerm, ValueSetOptions, commandLine, createMessageFormatter, envVar, formatMessage, lineBreak, link, message, metavar, optionName, optionNames, text, value, valueSet, values } from "./message.cjs";
|
|
4
4
|
import { ErrorLabelTerm, LabelTerm, ProgramNameTerm, SyntaxPunctuationTerm, TerminalColor, TerminalFormatContext, TerminalFormatter, TerminalFragment, TerminalStyle, TerminalTerm, TerminalTheme, defaultTerminalTheme } from "./terminal.cjs";
|
|
5
5
|
import { HiddenVisibility, OptionName, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, cloneUsage, cloneUsageTerm, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, formatUsage, formatUsageTerm, isDocHidden, isSuggestionHidden, isUsageHidden, mergeHidden, normalizeUsage } from "./usage.cjs";
|
|
6
|
-
import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage, isDocEntryHidden } from "./doc.cjs";
|
|
6
|
+
import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, ShowEnvironmentOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, deriveEnvironmentSection, formatDocPage, isDocEntryHidden } from "./doc.cjs";
|
|
7
7
|
import { ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, Color, ColorFormat, ColorOptions, CronExpression, CronExpressionForOptions, CronOptions, DeferredMap, DomainOptions, EmailOptions, FileSizeOptions, FileSizeOptionsBigInt, FileSizeOptionsNumber, FileSizeUnit, FirstOfOptions, FloatOptions, HostnameOptions, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, Json, JsonOptions, KeyValueOptions, LocaleOptions, MacAddressOptions, OriginOptions, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, RegExpOptions, SemVer, SemVerOptionsObject, SemVerOptionsString, SemVerString, SocketAddressOptions, SocketAddressValue, StringOptions, TransformMapping, UrlOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, biject, checkBooleanOption, checkEnumOption, choice, cidr, color, cron, domain, email, fileSize, firstOf, float, hostname, integer, ip, ipv4, ipv6, isValueParser, json, keyValue, locale, macAddress, origin, port, portRange, regExp, semVer, socketAddress, string, transform, url, uuid } from "./valueparser.cjs";
|
|
8
8
|
import { CombineModes, DetailedParseResult, DocState, EffectfulCompletionSession, ExecutionContext, ExecutionPhase, InferMode, InferValue, Mode, ModeIterable, ModeValue, ParseFrame, Parser, ParserContext, ParserResult, Result, Suggestion, createParserContext, getDocPage, getDocPageAsync, getDocPageSync, parse, parseAsync, parseDetailed, parseSync, suggest, suggestAsync, suggestSync } from "./internal/parser.cjs";
|
|
9
9
|
import { ShellCompletion, bash, fish, nu, pwsh, zsh } from "./completion.cjs";
|
|
@@ -13,4 +13,4 @@ import { ParserValuePlaceholder, SourceContext, SourceContextRequest } from "./c
|
|
|
13
13
|
import { AnyDependencySource, CombineMode, CombinedDependencyMode, DependencyMode, DependencySource, DependencySourceInfo, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, dependency, deriveFrom, deriveFromAsync, deriveFromSync, getDependencySourceInfo, isDependencySource, isDerivedValueParser } from "./internal/dependency.cjs";
|
|
14
14
|
import { CommandListMode, CommandSubConfig, ContextOptionsParam, ExtractRequiredOptions, HelpSectionsOptions, OptionSubConfig, RunOptions, RunParserError, RunWithOptions, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.cjs";
|
|
15
15
|
import { ArgumentErrorOptions, ArgumentOptions, CommandErrorOptions, CommandOptions, FlagErrorOptions, FlagOptions, NegatableFlagErrorOptions, NegatableFlagNameList, NegatableFlagNames, NegatableFlagOptions, NegatableFlagState, OptionErrorOptions, OptionOptions, OptionState, PassThroughFormat, PassThroughOptions, argument, command, constant, fail, flag, negatableFlag, option, passThrough } from "./primitives.cjs";
|
|
16
|
-
export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, Color, ColorFormat, ColorOptions, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandListMode, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, CronExpression, CronExpressionForOptions, CronOptions, DeferredMap, DeferredValue, DeferredValueOptions, DeferredValueSource, DependencyMode, DependencySource, DependencySourceInfo, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DetailedParseResult, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DomainOptions, DuplicateOptionError, EffectfulCompletionSession, EmailOptions, ErrorLabelTerm, ExecutionContext, ExecutionPhase, ExtractRequiredOptions, FileSizeOptions, FileSizeOptionsBigInt, FileSizeOptionsNumber, FileSizeUnit, FirstOfOptions, FlagErrorOptions, FlagOptions, FloatOptions, FluentParser, GroupOptions, HelpSectionsOptions, HiddenVisibility, HostnameOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, Json, JsonOptions, KeyValueOptions, LabelTerm, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MacAddressOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageFormatter, type MessageFormatterOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NegatableFlagErrorOptions, NegatableFlagNameList, NegatableFlagNames, NegatableFlagOptions, NegatableFlagState, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OptionSubConfig, OrErrorOptions, OrOptions, OriginOptions, ParseFrame, type ParseOptions, Parser, ParserContext, ParserModifiers, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, ProgramNameTerm, RegExpOptions, Result, RunOptions, RunParserError, RunWithOptions, SemVer, SemVerOptionsObject, SemVerOptionsString, SemVerString, SeqOptions, ShellCompletion, ShowChoicesOptions, ShowDefaultOptions, SocketAddressOptions, SocketAddressValue, SourceContext, SourceContextRequest, StringOptions, SubstituteParserValue, Suggestion, SyntaxPunctuationTerm, TerminalColor, TerminalFormatContext, TerminalFormatter, TerminalFragment, TerminalStyle, TerminalTerm, TerminalTheme, TransformMapping, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, argument, bash, biject, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, color, command, commandLine, concat, conditional, constant, createMessageFormatter, createParserContext, cron, deduplicateDocEntries, deduplicateDocFragments, defaultTerminalTheme, deferredValue, dependency, deriveFrom, deriveFromAsync, deriveFromSync, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, fail, fileSize, firstOf, fish, flag, float, fluent, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDependencySourceInfo, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, integer, ip, ipv4, ipv6, isDeferredValue, isDependencySource, isDerivedValueParser, isDocEntryHidden, isDocHidden, isNonEmptyString, isSuggestionHidden, isUsageHidden, isValueParser, json, keyValue, lineBreak, link, locale, longestMatch, macAddress, map, merge, mergeHidden, message, metavar, multiple, negatableFlag, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, origin, parse, parseAsync, parseDetailed, parseSync, passThrough, port, portRange, pwsh, regExp, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, semVer, seq, socketAddress, string, suggest, suggestAsync, suggestSync, text, transform, tuple, url, uuid, value, valueSet, values, withDefault, zsh };
|
|
16
|
+
export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, Color, ColorFormat, ColorOptions, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandListMode, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, CronExpression, CronExpressionForOptions, CronOptions, DeferredMap, DeferredValue, DeferredValueOptions, DeferredValueSource, DependencyMode, DependencySource, DependencySourceInfo, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DetailedParseResult, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DomainOptions, DuplicateOptionError, EffectfulCompletionSession, EmailOptions, ErrorLabelTerm, ExecutionContext, ExecutionPhase, ExtractRequiredOptions, FileSizeOptions, FileSizeOptionsBigInt, FileSizeOptionsNumber, FileSizeUnit, FirstOfOptions, FlagErrorOptions, FlagOptions, FloatOptions, FluentParser, GroupOptions, HelpSectionsOptions, HiddenVisibility, HostnameOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, Json, JsonOptions, KeyValueOptions, LabelTerm, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MacAddressOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageFormatter, type MessageFormatterOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NegatableFlagErrorOptions, NegatableFlagNameList, NegatableFlagNames, NegatableFlagOptions, NegatableFlagState, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OptionSubConfig, OrErrorOptions, OrOptions, OriginOptions, ParseFrame, type ParseOptions, Parser, ParserContext, ParserModifiers, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, ProgramNameTerm, RegExpOptions, Result, RunOptions, RunParserError, RunWithOptions, SemVer, SemVerOptionsObject, SemVerOptionsString, SemVerString, SeqOptions, ShellCompletion, ShowChoicesOptions, ShowDefaultOptions, ShowEnvironmentOptions, SocketAddressOptions, SocketAddressValue, SourceContext, SourceContextRequest, StringOptions, SubstituteParserValue, Suggestion, SyntaxPunctuationTerm, TerminalColor, TerminalFormatContext, TerminalFormatter, TerminalFragment, TerminalStyle, TerminalTerm, TerminalTheme, TransformMapping, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, argument, bash, biject, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, color, command, commandLine, concat, conditional, constant, createMessageFormatter, createParserContext, cron, deduplicateDocEntries, deduplicateDocFragments, defaultTerminalTheme, deferredValue, dependency, deriveEnvironmentSection, deriveFrom, deriveFromAsync, deriveFromSync, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, fail, fileSize, firstOf, fish, flag, float, fluent, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDependencySourceInfo, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, integer, ip, ipv4, ipv6, isDeferredValue, isDependencySource, isDerivedValueParser, isDocEntryHidden, isDocHidden, isNonEmptyString, isSuggestionHidden, isUsageHidden, isValueParser, json, keyValue, lineBreak, link, locale, longestMatch, macAddress, map, merge, mergeHidden, message, metavar, multiple, negatableFlag, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, origin, parse, parseAsync, parseDetailed, parseSync, passThrough, port, portRange, pwsh, regExp, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, semVer, seq, socketAddress, string, suggest, suggestAsync, suggestSync, text, transform, tuple, url, uuid, value, valueSet, values, withDefault, zsh };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { NonEmptyString, ensureNonEmptyString, isNonEmptyString } from "./nonemp
|
|
|
3
3
|
import { Message, MessageFormatOptions, MessageFormatter, MessageFormatterOptions, MessageTerm, ValueSetOptions, commandLine, createMessageFormatter, envVar, formatMessage, lineBreak, link, message, metavar, optionName, optionNames, text, value, valueSet, values } from "./message.js";
|
|
4
4
|
import { ErrorLabelTerm, LabelTerm, ProgramNameTerm, SyntaxPunctuationTerm, TerminalColor, TerminalFormatContext, TerminalFormatter, TerminalFragment, TerminalStyle, TerminalTerm, TerminalTheme, defaultTerminalTheme } from "./terminal.js";
|
|
5
5
|
import { HiddenVisibility, OptionName, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, cloneUsage, cloneUsageTerm, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, formatUsage, formatUsageTerm, isDocHidden, isSuggestionHidden, isUsageHidden, mergeHidden, normalizeUsage } from "./usage.js";
|
|
6
|
-
import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage, isDocEntryHidden } from "./doc.js";
|
|
6
|
+
import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, ShowEnvironmentOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, deriveEnvironmentSection, formatDocPage, isDocEntryHidden } from "./doc.js";
|
|
7
7
|
import { ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, Color, ColorFormat, ColorOptions, CronExpression, CronExpressionForOptions, CronOptions, DeferredMap, DomainOptions, EmailOptions, FileSizeOptions, FileSizeOptionsBigInt, FileSizeOptionsNumber, FileSizeUnit, FirstOfOptions, FloatOptions, HostnameOptions, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, Json, JsonOptions, KeyValueOptions, LocaleOptions, MacAddressOptions, OriginOptions, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, RegExpOptions, SemVer, SemVerOptionsObject, SemVerOptionsString, SemVerString, SocketAddressOptions, SocketAddressValue, StringOptions, TransformMapping, UrlOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, biject, checkBooleanOption, checkEnumOption, choice, cidr, color, cron, domain, email, fileSize, firstOf, float, hostname, integer, ip, ipv4, ipv6, isValueParser, json, keyValue, locale, macAddress, origin, port, portRange, regExp, semVer, socketAddress, string, transform, url, uuid } from "./valueparser.js";
|
|
8
8
|
import { CombineModes, DetailedParseResult, DocState, EffectfulCompletionSession, ExecutionContext, ExecutionPhase, InferMode, InferValue, Mode, ModeIterable, ModeValue, ParseFrame, Parser, ParserContext, ParserResult, Result, Suggestion, createParserContext, getDocPage, getDocPageAsync, getDocPageSync, parse, parseAsync, parseDetailed, parseSync, suggest, suggestAsync, suggestSync } from "./internal/parser.js";
|
|
9
9
|
import { ShellCompletion, bash, fish, nu, pwsh, zsh } from "./completion.js";
|
|
@@ -13,4 +13,4 @@ import { ParserValuePlaceholder, SourceContext, SourceContextRequest } from "./c
|
|
|
13
13
|
import { AnyDependencySource, CombineMode, CombinedDependencyMode, DependencyMode, DependencySource, DependencySourceInfo, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, dependency, deriveFrom, deriveFromAsync, deriveFromSync, getDependencySourceInfo, isDependencySource, isDerivedValueParser } from "./internal/dependency.js";
|
|
14
14
|
import { CommandListMode, CommandSubConfig, ContextOptionsParam, ExtractRequiredOptions, HelpSectionsOptions, OptionSubConfig, RunOptions, RunParserError, RunWithOptions, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.js";
|
|
15
15
|
import { ArgumentErrorOptions, ArgumentOptions, CommandErrorOptions, CommandOptions, FlagErrorOptions, FlagOptions, NegatableFlagErrorOptions, NegatableFlagNameList, NegatableFlagNames, NegatableFlagOptions, NegatableFlagState, OptionErrorOptions, OptionOptions, OptionState, PassThroughFormat, PassThroughOptions, argument, command, constant, fail, flag, negatableFlag, option, passThrough } from "./primitives.js";
|
|
16
|
-
export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, Color, ColorFormat, ColorOptions, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandListMode, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, CronExpression, CronExpressionForOptions, CronOptions, DeferredMap, DeferredValue, DeferredValueOptions, DeferredValueSource, DependencyMode, DependencySource, DependencySourceInfo, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DetailedParseResult, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DomainOptions, DuplicateOptionError, EffectfulCompletionSession, EmailOptions, ErrorLabelTerm, ExecutionContext, ExecutionPhase, ExtractRequiredOptions, FileSizeOptions, FileSizeOptionsBigInt, FileSizeOptionsNumber, FileSizeUnit, FirstOfOptions, FlagErrorOptions, FlagOptions, FloatOptions, FluentParser, GroupOptions, HelpSectionsOptions, HiddenVisibility, HostnameOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, Json, JsonOptions, KeyValueOptions, LabelTerm, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MacAddressOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageFormatter, type MessageFormatterOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NegatableFlagErrorOptions, NegatableFlagNameList, NegatableFlagNames, NegatableFlagOptions, NegatableFlagState, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OptionSubConfig, OrErrorOptions, OrOptions, OriginOptions, ParseFrame, type ParseOptions, Parser, ParserContext, ParserModifiers, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, ProgramNameTerm, RegExpOptions, Result, RunOptions, RunParserError, RunWithOptions, SemVer, SemVerOptionsObject, SemVerOptionsString, SemVerString, SeqOptions, ShellCompletion, ShowChoicesOptions, ShowDefaultOptions, SocketAddressOptions, SocketAddressValue, SourceContext, SourceContextRequest, StringOptions, SubstituteParserValue, Suggestion, SyntaxPunctuationTerm, TerminalColor, TerminalFormatContext, TerminalFormatter, TerminalFragment, TerminalStyle, TerminalTerm, TerminalTheme, TransformMapping, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, argument, bash, biject, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, color, command, commandLine, concat, conditional, constant, createMessageFormatter, createParserContext, cron, deduplicateDocEntries, deduplicateDocFragments, defaultTerminalTheme, deferredValue, dependency, deriveFrom, deriveFromAsync, deriveFromSync, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, fail, fileSize, firstOf, fish, flag, float, fluent, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDependencySourceInfo, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, integer, ip, ipv4, ipv6, isDeferredValue, isDependencySource, isDerivedValueParser, isDocEntryHidden, isDocHidden, isNonEmptyString, isSuggestionHidden, isUsageHidden, isValueParser, json, keyValue, lineBreak, link, locale, longestMatch, macAddress, map, merge, mergeHidden, message, metavar, multiple, negatableFlag, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, origin, parse, parseAsync, parseDetailed, parseSync, passThrough, port, portRange, pwsh, regExp, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, semVer, seq, socketAddress, string, suggest, suggestAsync, suggestSync, text, transform, tuple, url, uuid, value, valueSet, values, withDefault, zsh };
|
|
16
|
+
export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, Color, ColorFormat, ColorOptions, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandListMode, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, CronExpression, CronExpressionForOptions, CronOptions, DeferredMap, DeferredValue, DeferredValueOptions, DeferredValueSource, DependencyMode, DependencySource, DependencySourceInfo, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DetailedParseResult, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DomainOptions, DuplicateOptionError, EffectfulCompletionSession, EmailOptions, ErrorLabelTerm, ExecutionContext, ExecutionPhase, ExtractRequiredOptions, FileSizeOptions, FileSizeOptionsBigInt, FileSizeOptionsNumber, FileSizeUnit, FirstOfOptions, FlagErrorOptions, FlagOptions, FloatOptions, FluentParser, GroupOptions, HelpSectionsOptions, HiddenVisibility, HostnameOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, Json, JsonOptions, KeyValueOptions, LabelTerm, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MacAddressOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageFormatter, type MessageFormatterOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NegatableFlagErrorOptions, NegatableFlagNameList, NegatableFlagNames, NegatableFlagOptions, NegatableFlagState, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OptionSubConfig, OrErrorOptions, OrOptions, OriginOptions, ParseFrame, type ParseOptions, Parser, ParserContext, ParserModifiers, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, ProgramNameTerm, RegExpOptions, Result, RunOptions, RunParserError, RunWithOptions, SemVer, SemVerOptionsObject, SemVerOptionsString, SemVerString, SeqOptions, ShellCompletion, ShowChoicesOptions, ShowDefaultOptions, ShowEnvironmentOptions, SocketAddressOptions, SocketAddressValue, SourceContext, SourceContextRequest, StringOptions, SubstituteParserValue, Suggestion, SyntaxPunctuationTerm, TerminalColor, TerminalFormatContext, TerminalFormatter, TerminalFragment, TerminalStyle, TerminalTerm, TerminalTheme, TransformMapping, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, argument, bash, biject, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, color, command, commandLine, concat, conditional, constant, createMessageFormatter, createParserContext, cron, deduplicateDocEntries, deduplicateDocFragments, defaultTerminalTheme, deferredValue, dependency, deriveEnvironmentSection, deriveFrom, deriveFromAsync, deriveFromSync, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, fail, fileSize, firstOf, fish, flag, float, fluent, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDependencySourceInfo, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, integer, ip, ipv4, ipv6, isDeferredValue, isDependencySource, isDerivedValueParser, isDocEntryHidden, isDocHidden, isNonEmptyString, isSuggestionHidden, isUsageHidden, isValueParser, json, keyValue, lineBreak, link, locale, longestMatch, macAddress, map, merge, mergeHidden, message, metavar, multiple, negatableFlag, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, origin, parse, parseAsync, parseDetailed, parseSync, passThrough, port, portRange, pwsh, regExp, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, semVer, seq, socketAddress, string, suggest, suggestAsync, suggestSync, text, transform, tuple, url, uuid, value, valueSet, values, withDefault, zsh };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { getAnnotations } from "./internal/annotations.js";
|
|
|
2
2
|
import { defaultTerminalTheme } from "./terminal.js";
|
|
3
3
|
import { cloneUsage, cloneUsageTerm, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, formatUsage, formatUsageTerm, isDocHidden, isSuggestionHidden, isUsageHidden, mergeHidden, normalizeUsage } from "./usage.js";
|
|
4
4
|
import { commandLine, createMessageFormatter, envVar, formatMessage, lineBreak, link, message, metavar, optionName, optionNames, text, value, valueSet, values } from "./message.js";
|
|
5
|
-
import { cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage, isDocEntryHidden } from "./doc.js";
|
|
5
|
+
import { cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, deriveEnvironmentSection, formatDocPage, isDocEntryHidden } from "./doc.js";
|
|
6
6
|
import { dependency, deriveFrom, deriveFromAsync, deriveFromSync, getDependencySourceInfo, isDependencySource, isDerivedValueParser } from "./internal/dependency.js";
|
|
7
7
|
import { createParserContext, getDocPage, getDocPageAsync, getDocPageSync, parse, parseAsync, parseDetailed, parseSync, suggest, suggestAsync, suggestSync } from "./internal/parser.js";
|
|
8
8
|
import { bash, fish, nu, pwsh, zsh } from "./completion.js";
|
|
@@ -13,4 +13,4 @@ import { biject, checkBooleanOption, checkEnumOption, choice, cidr, color, cron,
|
|
|
13
13
|
import { argument, command, constant, fail, flag, negatableFlag, option, passThrough } from "./primitives.js";
|
|
14
14
|
import { RunParserError, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.js";
|
|
15
15
|
|
|
16
|
-
export { DuplicateOptionError, RunParserError, WithDefaultError, argument, bash, biject, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, color, command, commandLine, concat, conditional, constant, createMessageFormatter, createParserContext, cron, deduplicateDocEntries, deduplicateDocFragments, defaultTerminalTheme, deferredValue, dependency, deriveFrom, deriveFromAsync, deriveFromSync, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, fail, fileSize, firstOf, fish, flag, float, fluent, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDependencySourceInfo, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, integer, ip, ipv4, ipv6, isDeferredValue, isDependencySource, isDerivedValueParser, isDocEntryHidden, isDocHidden, isNonEmptyString, isSuggestionHidden, isUsageHidden, isValueParser, json, keyValue, lineBreak, link, locale, longestMatch, macAddress, map, merge, mergeHidden, message, metavar, multiple, negatableFlag, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, origin, parse, parseAsync, parseDetailed, parseSync, passThrough, port, portRange, pwsh, regExp, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, semVer, seq, socketAddress, string, suggest, suggestAsync, suggestSync, text, transform, tuple, url, uuid, value, valueSet, values, withDefault, zsh };
|
|
16
|
+
export { DuplicateOptionError, RunParserError, WithDefaultError, argument, bash, biject, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, color, command, commandLine, concat, conditional, constant, createMessageFormatter, createParserContext, cron, deduplicateDocEntries, deduplicateDocFragments, defaultTerminalTheme, deferredValue, dependency, deriveEnvironmentSection, deriveFrom, deriveFromAsync, deriveFromSync, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, fail, fileSize, firstOf, fish, flag, float, fluent, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDependencySourceInfo, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, integer, ip, ipv4, ipv6, isDeferredValue, isDependencySource, isDerivedValueParser, isDocEntryHidden, isDocHidden, isNonEmptyString, isSuggestionHidden, isUsageHidden, isValueParser, json, keyValue, lineBreak, link, locale, longestMatch, macAddress, map, merge, mergeHidden, message, metavar, multiple, negatableFlag, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, origin, parse, parseAsync, parseDetailed, parseSync, passThrough, port, portRange, pwsh, regExp, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, semVer, seq, socketAddress, string, suggest, suggestAsync, suggestSync, text, transform, tuple, url, uuid, value, valueSet, values, withDefault, zsh };
|
|
@@ -287,7 +287,8 @@ function cacheTerminalTheme(theme = {}) {
|
|
|
287
287
|
errorLabel: cache(theme.errorLabel ?? require_terminal.defaultTerminalTheme.errorLabel),
|
|
288
288
|
annotationStyles: theme.annotationStyles == null ? void 0 : {
|
|
289
289
|
default: theme.annotationStyles.default == null ? void 0 : { ...theme.annotationStyles.default },
|
|
290
|
-
choices: theme.annotationStyles.choices == null ? void 0 : { ...theme.annotationStyles.choices }
|
|
290
|
+
choices: theme.annotationStyles.choices == null ? void 0 : { ...theme.annotationStyles.choices },
|
|
291
|
+
environment: theme.annotationStyles.environment == null ? void 0 : { ...theme.annotationStyles.environment }
|
|
291
292
|
}
|
|
292
293
|
};
|
|
293
294
|
}
|
|
@@ -287,7 +287,8 @@ function cacheTerminalTheme(theme = {}) {
|
|
|
287
287
|
errorLabel: cache(theme.errorLabel ?? defaultTerminalTheme.errorLabel),
|
|
288
288
|
annotationStyles: theme.annotationStyles == null ? void 0 : {
|
|
289
289
|
default: theme.annotationStyles.default == null ? void 0 : { ...theme.annotationStyles.default },
|
|
290
|
-
choices: theme.annotationStyles.choices == null ? void 0 : { ...theme.annotationStyles.choices }
|
|
290
|
+
choices: theme.annotationStyles.choices == null ? void 0 : { ...theme.annotationStyles.choices },
|
|
291
|
+
environment: theme.annotationStyles.environment == null ? void 0 : { ...theme.annotationStyles.environment }
|
|
291
292
|
}
|
|
292
293
|
};
|
|
293
294
|
}
|
package/dist/terminal.d.cts
CHANGED
|
@@ -114,6 +114,8 @@ type TerminalTheme = Partial<Formatters> & {
|
|
|
114
114
|
readonly annotationStyles?: {
|
|
115
115
|
readonly default?: TerminalStyle;
|
|
116
116
|
readonly choices?: TerminalStyle;
|
|
117
|
+
/** Environment annotation style. @since 1.4.0 */
|
|
118
|
+
readonly environment?: TerminalStyle;
|
|
117
119
|
};
|
|
118
120
|
};
|
|
119
121
|
/**
|
package/dist/terminal.d.ts
CHANGED
|
@@ -114,6 +114,8 @@ type TerminalTheme = Partial<Formatters> & {
|
|
|
114
114
|
readonly annotationStyles?: {
|
|
115
115
|
readonly default?: TerminalStyle;
|
|
116
116
|
readonly choices?: TerminalStyle;
|
|
117
|
+
/** Environment annotation style. @since 1.4.0 */
|
|
118
|
+
readonly environment?: TerminalStyle;
|
|
117
119
|
};
|
|
118
120
|
};
|
|
119
121
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/core",
|
|
3
|
-
"version": "1.4.0-dev.
|
|
3
|
+
"version": "1.4.0-dev.2633",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
},
|
|
238
238
|
"sideEffects": false,
|
|
239
239
|
"devDependencies": {
|
|
240
|
-
"@optique/env": "1.4.0-dev.
|
|
240
|
+
"@optique/env": "1.4.0-dev.2633+ee18a31e",
|
|
241
241
|
"@types/node": "^24.0.0",
|
|
242
242
|
"fast-check": "^4.7.0",
|
|
243
243
|
"tsdown": "^0.13.0",
|
package/skills/optique/SKILL.md
CHANGED
|
@@ -245,10 +245,10 @@ Common mistakes checklist
|
|
|
245
245
|
`nonEmpty()` when at least one value is required.
|
|
246
246
|
- Do not confuse free-order parsing with `seq()`. Most constructs let child
|
|
247
247
|
parsers compete by priority; use `seq()` only for truly ordered grammars.
|
|
248
|
-
-
|
|
249
|
-
`message` values.
|
|
248
|
+
- Use structured `message` values for errors and descriptions.
|
|
250
249
|
- Register contexts for `bindEnv()`, `bindConfig()`, `bindDerivedDefault()`,
|
|
251
250
|
and `bindKeyring()` in the runner's `contexts` option.
|
|
251
|
+
- Show `bindEnv()` names in help with `showEnvironment: true`.
|
|
252
252
|
- Do not flatten a multi-level dependency graph into duplicated one-level
|
|
253
253
|
factories. Wrap each derived value that becomes a later source with
|
|
254
254
|
`dependency()` and derive the next parser from it.
|