@optique/core 0.10.0-dev.328 → 0.10.0-dev.330
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/facade.cjs +4 -3
- package/dist/facade.js +4 -3
- 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/message.cjs +52 -0
- package/dist/message.d.cts +39 -1
- package/dist/message.d.ts +39 -1
- package/dist/message.js +51 -1
- package/package.json +1 -1
package/dist/facade.cjs
CHANGED
|
@@ -529,13 +529,14 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
529
529
|
const displayHelp = (doc) => {
|
|
530
530
|
if (doc != null) {
|
|
531
531
|
const isMetaCommandHelp = (completionName === "singular" || completionName === "both" ? requestedCommand === "completion" : false) || (completionName === "plural" || completionName === "both" ? requestedCommand === "completions" : false) || requestedCommand === "help" || requestedCommand === "version";
|
|
532
|
+
const isTopLevel = classified.commands.length === 0;
|
|
532
533
|
const augmentedDoc = {
|
|
533
534
|
...doc,
|
|
534
535
|
brief: !isMetaCommandHelp ? brief ?? doc.brief : doc.brief,
|
|
535
536
|
description: !isMetaCommandHelp ? description ?? doc.description : doc.description,
|
|
536
|
-
examples: !isMetaCommandHelp ? examples ?? doc.examples :
|
|
537
|
-
author: !isMetaCommandHelp ? author ?? doc.author :
|
|
538
|
-
bugs: !isMetaCommandHelp ? bugs ?? doc.bugs :
|
|
537
|
+
examples: isTopLevel && !isMetaCommandHelp ? examples ?? doc.examples : void 0,
|
|
538
|
+
author: isTopLevel && !isMetaCommandHelp ? author ?? doc.author : void 0,
|
|
539
|
+
bugs: isTopLevel && !isMetaCommandHelp ? bugs ?? doc.bugs : void 0,
|
|
539
540
|
footer: !isMetaCommandHelp ? footer ?? doc.footer : doc.footer
|
|
540
541
|
};
|
|
541
542
|
stdout(require_doc.formatDocPage(programName, augmentedDoc, {
|
package/dist/facade.js
CHANGED
|
@@ -529,13 +529,14 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
529
529
|
const displayHelp = (doc) => {
|
|
530
530
|
if (doc != null) {
|
|
531
531
|
const isMetaCommandHelp = (completionName === "singular" || completionName === "both" ? requestedCommand === "completion" : false) || (completionName === "plural" || completionName === "both" ? requestedCommand === "completions" : false) || requestedCommand === "help" || requestedCommand === "version";
|
|
532
|
+
const isTopLevel = classified.commands.length === 0;
|
|
532
533
|
const augmentedDoc = {
|
|
533
534
|
...doc,
|
|
534
535
|
brief: !isMetaCommandHelp ? brief ?? doc.brief : doc.brief,
|
|
535
536
|
description: !isMetaCommandHelp ? description ?? doc.description : doc.description,
|
|
536
|
-
examples: !isMetaCommandHelp ? examples ?? doc.examples :
|
|
537
|
-
author: !isMetaCommandHelp ? author ?? doc.author :
|
|
538
|
-
bugs: !isMetaCommandHelp ? bugs ?? doc.bugs :
|
|
537
|
+
examples: isTopLevel && !isMetaCommandHelp ? examples ?? doc.examples : void 0,
|
|
538
|
+
author: isTopLevel && !isMetaCommandHelp ? author ?? doc.author : void 0,
|
|
539
|
+
bugs: isTopLevel && !isMetaCommandHelp ? bugs ?? doc.bugs : void 0,
|
|
539
540
|
footer: !isMetaCommandHelp ? footer ?? doc.footer : doc.footer
|
|
540
541
|
};
|
|
541
542
|
stdout(formatDocPage(programName, augmentedDoc, {
|
package/dist/index.cjs
CHANGED
|
@@ -65,6 +65,7 @@ exports.isNonEmptyString = require_nonempty.isNonEmptyString;
|
|
|
65
65
|
exports.isPendingDependencySourceState = require_dependency.isPendingDependencySourceState;
|
|
66
66
|
exports.isValueParser = require_valueparser.isValueParser;
|
|
67
67
|
exports.isWrappedDependencySource = require_dependency.isWrappedDependencySource;
|
|
68
|
+
exports.link = require_message.link;
|
|
68
69
|
exports.locale = require_valueparser.locale;
|
|
69
70
|
exports.longestMatch = require_constructs.longestMatch;
|
|
70
71
|
exports.map = require_modifiers.map;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NonEmptyString, ensureNonEmptyString, isNonEmptyString } from "./nonempty.cjs";
|
|
2
|
-
import { Message, MessageFormatOptions, MessageTerm, ValueSetOptions, commandLine, envVar, formatMessage, message, metavar, optionName, optionNames, text, value, valueSet, values } from "./message.cjs";
|
|
2
|
+
import { Message, MessageFormatOptions, MessageTerm, ValueSetOptions, commandLine, envVar, formatMessage, link, message, metavar, optionName, optionNames, text, value, valueSet, values } from "./message.cjs";
|
|
3
3
|
import { OptionName, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, extractArgumentMetavars, extractCommandNames, extractOptionNames, formatUsage, formatUsageTerm, normalizeUsage } from "./usage.cjs";
|
|
4
4
|
import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowDefaultOptions, formatDocPage } from "./doc.cjs";
|
|
5
5
|
import { ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, FloatOptions, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, StringOptions, UrlOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, choice, float, integer, isValueParser, locale, string, url, uuid } from "./valueparser.cjs";
|
|
@@ -10,4 +10,4 @@ import { ArgumentErrorOptions, ArgumentOptions, CommandErrorOptions, CommandOpti
|
|
|
10
10
|
import { CombineModes, DocState, InferMode, InferValue, Mode, ModeIterable, ModeValue, Parser, ParserContext, ParserResult, Result, Suggestion, getDocPage, getDocPageAsync, getDocPageSync, parse, parseAsync, parseSync, suggest, suggestAsync, suggestSync } from "./parser.cjs";
|
|
11
11
|
import { ShellCompletion, bash, fish, nu, pwsh, zsh } from "./completion.cjs";
|
|
12
12
|
import { RunOptions, RunParserError, runParser, runParserAsync, runParserSync } from "./facade.cjs";
|
|
13
|
-
export { AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, ConditionalErrorOptions, ConditionalOptions, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DuplicateOptionError, FlagErrorOptions, FlagOptions, FloatOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, Message, MessageFormatOptions, MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OrErrorOptions, OrOptions, Parser, ParserContext, ParserResult, PassThroughFormat, PassThroughOptions, PendingDependencySourceState, ResolvedDependency, Result, RunOptions, RunParserError, ShellCompletion, ShowDefaultOptions, StringOptions, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, ValueSetOptions, WithDefaultError, WithDefaultOptions, argument, bash, choice, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, integer, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isNonEmptyString, isPendingDependencySourceState, isValueParser, isWrappedDependencySource, locale, longestMatch, map, merge, message, metavar, multiple, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, parseWithDependency, passThrough, pendingDependencySourceStateMarker, pwsh, runParser, runParserAsync, runParserSync, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
|
|
13
|
+
export { AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, ConditionalErrorOptions, ConditionalOptions, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DuplicateOptionError, FlagErrorOptions, FlagOptions, FloatOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OrErrorOptions, OrOptions, Parser, ParserContext, ParserResult, PassThroughFormat, PassThroughOptions, PendingDependencySourceState, ResolvedDependency, Result, RunOptions, RunParserError, ShellCompletion, ShowDefaultOptions, StringOptions, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, argument, bash, choice, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, integer, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isNonEmptyString, isPendingDependencySourceState, isValueParser, isWrappedDependencySource, link, locale, longestMatch, map, merge, message, metavar, multiple, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, parseWithDependency, passThrough, pendingDependencySourceStateMarker, pwsh, runParser, runParserAsync, runParserSync, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NonEmptyString, ensureNonEmptyString, isNonEmptyString } from "./nonempty.js";
|
|
2
|
-
import { Message, MessageFormatOptions, MessageTerm, ValueSetOptions, commandLine, envVar, formatMessage, message, metavar, optionName, optionNames, text, value, valueSet, values } from "./message.js";
|
|
2
|
+
import { Message, MessageFormatOptions, MessageTerm, ValueSetOptions, commandLine, envVar, formatMessage, link, message, metavar, optionName, optionNames, text, value, valueSet, values } from "./message.js";
|
|
3
3
|
import { OptionName, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, extractArgumentMetavars, extractCommandNames, extractOptionNames, formatUsage, formatUsageTerm, normalizeUsage } from "./usage.js";
|
|
4
4
|
import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowDefaultOptions, formatDocPage } from "./doc.js";
|
|
5
5
|
import { ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, FloatOptions, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, StringOptions, UrlOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, choice, float, integer, isValueParser, locale, string, url, uuid } from "./valueparser.js";
|
|
@@ -10,4 +10,4 @@ import { ArgumentErrorOptions, ArgumentOptions, CommandErrorOptions, CommandOpti
|
|
|
10
10
|
import { CombineModes, DocState, InferMode, InferValue, Mode, ModeIterable, ModeValue, Parser, ParserContext, ParserResult, Result, Suggestion, getDocPage, getDocPageAsync, getDocPageSync, parse, parseAsync, parseSync, suggest, suggestAsync, suggestSync } from "./parser.js";
|
|
11
11
|
import { ShellCompletion, bash, fish, nu, pwsh, zsh } from "./completion.js";
|
|
12
12
|
import { RunOptions, RunParserError, runParser, runParserAsync, runParserSync } from "./facade.js";
|
|
13
|
-
export { AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, ConditionalErrorOptions, ConditionalOptions, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DuplicateOptionError, FlagErrorOptions, FlagOptions, FloatOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, Message, MessageFormatOptions, MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OrErrorOptions, OrOptions, Parser, ParserContext, ParserResult, PassThroughFormat, PassThroughOptions, PendingDependencySourceState, ResolvedDependency, Result, RunOptions, RunParserError, ShellCompletion, ShowDefaultOptions, StringOptions, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, ValueSetOptions, WithDefaultError, WithDefaultOptions, argument, bash, choice, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, integer, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isNonEmptyString, isPendingDependencySourceState, isValueParser, isWrappedDependencySource, locale, longestMatch, map, merge, message, metavar, multiple, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, parseWithDependency, passThrough, pendingDependencySourceStateMarker, pwsh, runParser, runParserAsync, runParserSync, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
|
|
13
|
+
export { AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, ConditionalErrorOptions, ConditionalOptions, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DuplicateOptionError, FlagErrorOptions, FlagOptions, FloatOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OrErrorOptions, OrOptions, Parser, ParserContext, ParserResult, PassThroughFormat, PassThroughOptions, PendingDependencySourceState, ResolvedDependency, Result, RunOptions, RunParserError, ShellCompletion, ShowDefaultOptions, StringOptions, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, argument, bash, choice, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, integer, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isNonEmptyString, isPendingDependencySourceState, isValueParser, isWrappedDependencySource, link, locale, longestMatch, map, merge, message, metavar, multiple, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, parseWithDependency, passThrough, pendingDependencySourceStateMarker, pwsh, runParser, runParserAsync, runParserSync, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { commandLine, envVar, formatMessage, message, metavar, optionName, optionNames, text, value, valueSet, values } from "./message.js";
|
|
1
|
+
import { commandLine, envVar, formatMessage, link, message, metavar, optionName, optionNames, text, value, valueSet, values } from "./message.js";
|
|
2
2
|
import { bash, fish, nu, pwsh, zsh } from "./completion.js";
|
|
3
3
|
import { DependencyRegistry, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, formatDependencyError, getDefaultValuesFunction, getDependencyIds, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isPendingDependencySourceState, isWrappedDependencySource, parseWithDependency, pendingDependencySourceStateMarker, suggestWithDependency, transformsDependencyValue, transformsDependencyValueMarker, wrappedDependencySourceMarker } from "./dependency.js";
|
|
4
4
|
import { extractArgumentMetavars, extractCommandNames, extractOptionNames, formatUsage, formatUsageTerm, normalizeUsage } from "./usage.js";
|
|
@@ -11,4 +11,4 @@ import { argument, command, constant, flag, option, passThrough } from "./primit
|
|
|
11
11
|
import { getDocPage, getDocPageAsync, getDocPageSync, parse, parseAsync, parseSync, suggest, suggestAsync, suggestSync } from "./parser.js";
|
|
12
12
|
import { RunParserError, runParser, runParserAsync, runParserSync } from "./facade.js";
|
|
13
13
|
|
|
14
|
-
export { DependencyRegistry, DuplicateOptionError, RunParserError, WithDefaultError, argument, bash, choice, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, integer, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isNonEmptyString, isPendingDependencySourceState, isValueParser, isWrappedDependencySource, locale, longestMatch, map, merge, message, metavar, multiple, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, parseWithDependency, passThrough, pendingDependencySourceStateMarker, pwsh, runParser, runParserAsync, runParserSync, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
|
|
14
|
+
export { DependencyRegistry, DuplicateOptionError, RunParserError, WithDefaultError, argument, bash, choice, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, integer, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isNonEmptyString, isPendingDependencySourceState, isValueParser, isWrappedDependencySource, link, locale, longestMatch, map, merge, message, metavar, multiple, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, parseWithDependency, passThrough, pendingDependencySourceStateMarker, pwsh, runParser, runParserAsync, runParserSync, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
|
package/dist/message.cjs
CHANGED
|
@@ -140,6 +140,43 @@ function commandLine(commandLine$1) {
|
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
|
+
* Creates a {@link MessageTerm} for a URL.
|
|
144
|
+
* @param url The URL, which can be a URL object or a string that can be parsed
|
|
145
|
+
* as a URL. For example, `"https://example.com"` or
|
|
146
|
+
* `new URL("https://example.com")`.
|
|
147
|
+
* @returns A {@link MessageTerm} representing the URL.
|
|
148
|
+
* @throws {RangeError} If the URL string cannot be parsed.
|
|
149
|
+
* @since 0.10.0
|
|
150
|
+
*/
|
|
151
|
+
function url(url$1) {
|
|
152
|
+
let urlObj;
|
|
153
|
+
if (typeof url$1 === "string") {
|
|
154
|
+
if (!URL.canParse(url$1)) throw new RangeError(`Invalid URL: ${url$1}.`);
|
|
155
|
+
urlObj = new URL(url$1);
|
|
156
|
+
} else urlObj = url$1;
|
|
157
|
+
return {
|
|
158
|
+
type: "url",
|
|
159
|
+
url: urlObj
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Creates a {@link MessageTerm} for a URL (alias for {@link url}).
|
|
164
|
+
*
|
|
165
|
+
* This is an alias for the {@link url} function, provided for convenience
|
|
166
|
+
* when you want to avoid potential naming conflicts with the `url()` value
|
|
167
|
+
* parser from `@optique/core/valueparser`.
|
|
168
|
+
*
|
|
169
|
+
* @param href The URL, which can be a URL object or a string that can be parsed
|
|
170
|
+
* as a URL. For example, `"https://example.com"` or
|
|
171
|
+
* `new URL("https://example.com")`.
|
|
172
|
+
* @returns A {@link MessageTerm} representing the URL.
|
|
173
|
+
* @throws {RangeError} If the URL string cannot be parsed.
|
|
174
|
+
* @since 0.10.0
|
|
175
|
+
*/
|
|
176
|
+
function link(href) {
|
|
177
|
+
return url(href);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
143
180
|
* Creates a {@link Message} for a formatted list of values using the
|
|
144
181
|
* `Intl.ListFormat` API. This is useful for displaying choice lists
|
|
145
182
|
* in error messages with proper locale-aware formatting.
|
|
@@ -295,6 +332,19 @@ function formatMessage(msg, options = {}) {
|
|
|
295
332
|
text: useColors ? `\x1b[36m${cmd}${resetSequence}` : cmd,
|
|
296
333
|
width: cmd.length
|
|
297
334
|
};
|
|
335
|
+
} else if (term.type === "url") {
|
|
336
|
+
const urlString = term.url.href;
|
|
337
|
+
const displayText = useQuotes ? `<${urlString}>` : urlString;
|
|
338
|
+
if (useColors) {
|
|
339
|
+
const hyperlink = `\x1b]8;;${urlString}\x1b\\${displayText}\x1b]8;;\x1b\\${resetSuffix}`;
|
|
340
|
+
yield {
|
|
341
|
+
text: hyperlink,
|
|
342
|
+
width: displayText.length
|
|
343
|
+
};
|
|
344
|
+
} else yield {
|
|
345
|
+
text: displayText,
|
|
346
|
+
width: displayText.length
|
|
347
|
+
};
|
|
298
348
|
} else throw new TypeError(`Invalid MessageTerm type: ${term["type"]}.`);
|
|
299
349
|
}
|
|
300
350
|
let output = "";
|
|
@@ -319,11 +369,13 @@ function formatMessage(msg, options = {}) {
|
|
|
319
369
|
exports.commandLine = commandLine;
|
|
320
370
|
exports.envVar = envVar;
|
|
321
371
|
exports.formatMessage = formatMessage;
|
|
372
|
+
exports.link = link;
|
|
322
373
|
exports.message = message;
|
|
323
374
|
exports.metavar = metavar;
|
|
324
375
|
exports.optionName = optionName;
|
|
325
376
|
exports.optionNames = optionNames;
|
|
326
377
|
exports.text = text;
|
|
378
|
+
exports.url = url;
|
|
327
379
|
exports.value = value;
|
|
328
380
|
exports.valueSet = valueSet;
|
|
329
381
|
exports.values = values;
|
package/dist/message.d.cts
CHANGED
|
@@ -122,6 +122,19 @@ type MessageTerm =
|
|
|
122
122
|
* For example, `"myapp completion bash > myapp-completion.bash"`.
|
|
123
123
|
*/
|
|
124
124
|
readonly commandLine: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* A URL term in the message, which represents a clickable hyperlink.
|
|
128
|
+
* @since 0.10.0
|
|
129
|
+
*/ | {
|
|
130
|
+
/**
|
|
131
|
+
* The type of the term, which is `"url"` for a URL.
|
|
132
|
+
*/
|
|
133
|
+
readonly type: "url";
|
|
134
|
+
/**
|
|
135
|
+
* The URL object representing the hyperlink.
|
|
136
|
+
*/
|
|
137
|
+
readonly url: URL;
|
|
125
138
|
};
|
|
126
139
|
/**
|
|
127
140
|
* Type representing a message that can include styled/colored values.
|
|
@@ -210,6 +223,31 @@ declare function envVar(envVar: string): MessageTerm;
|
|
|
210
223
|
* @since 0.6.0
|
|
211
224
|
*/
|
|
212
225
|
declare function commandLine(commandLine: string): MessageTerm;
|
|
226
|
+
/**
|
|
227
|
+
* Creates a {@link MessageTerm} for a URL.
|
|
228
|
+
* @param url The URL, which can be a URL object or a string that can be parsed
|
|
229
|
+
* as a URL. For example, `"https://example.com"` or
|
|
230
|
+
* `new URL("https://example.com")`.
|
|
231
|
+
* @returns A {@link MessageTerm} representing the URL.
|
|
232
|
+
* @throws {RangeError} If the URL string cannot be parsed.
|
|
233
|
+
* @since 0.10.0
|
|
234
|
+
*/
|
|
235
|
+
declare function url(url: string | URL): MessageTerm;
|
|
236
|
+
/**
|
|
237
|
+
* Creates a {@link MessageTerm} for a URL (alias for {@link url}).
|
|
238
|
+
*
|
|
239
|
+
* This is an alias for the {@link url} function, provided for convenience
|
|
240
|
+
* when you want to avoid potential naming conflicts with the `url()` value
|
|
241
|
+
* parser from `@optique/core/valueparser`.
|
|
242
|
+
*
|
|
243
|
+
* @param href The URL, which can be a URL object or a string that can be parsed
|
|
244
|
+
* as a URL. For example, `"https://example.com"` or
|
|
245
|
+
* `new URL("https://example.com")`.
|
|
246
|
+
* @returns A {@link MessageTerm} representing the URL.
|
|
247
|
+
* @throws {RangeError} If the URL string cannot be parsed.
|
|
248
|
+
* @since 0.10.0
|
|
249
|
+
*/
|
|
250
|
+
declare function link(href: string | URL): MessageTerm;
|
|
213
251
|
/**
|
|
214
252
|
* Options for the {@link valueSet} function.
|
|
215
253
|
* @since 0.9.0
|
|
@@ -323,4 +361,4 @@ interface MessageFormatOptions {
|
|
|
323
361
|
*/
|
|
324
362
|
declare function formatMessage(msg: Message, options?: MessageFormatOptions): string;
|
|
325
363
|
//#endregion
|
|
326
|
-
export { Message, MessageFormatOptions, MessageTerm, ValueSetOptions, commandLine, envVar, formatMessage, message, metavar, optionName, optionNames, text, value, valueSet, values };
|
|
364
|
+
export { Message, MessageFormatOptions, MessageTerm, ValueSetOptions, commandLine, envVar, formatMessage, link, message, metavar, optionName, optionNames, text, url, value, valueSet, values };
|
package/dist/message.d.ts
CHANGED
|
@@ -122,6 +122,19 @@ type MessageTerm =
|
|
|
122
122
|
* For example, `"myapp completion bash > myapp-completion.bash"`.
|
|
123
123
|
*/
|
|
124
124
|
readonly commandLine: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* A URL term in the message, which represents a clickable hyperlink.
|
|
128
|
+
* @since 0.10.0
|
|
129
|
+
*/ | {
|
|
130
|
+
/**
|
|
131
|
+
* The type of the term, which is `"url"` for a URL.
|
|
132
|
+
*/
|
|
133
|
+
readonly type: "url";
|
|
134
|
+
/**
|
|
135
|
+
* The URL object representing the hyperlink.
|
|
136
|
+
*/
|
|
137
|
+
readonly url: URL;
|
|
125
138
|
};
|
|
126
139
|
/**
|
|
127
140
|
* Type representing a message that can include styled/colored values.
|
|
@@ -210,6 +223,31 @@ declare function envVar(envVar: string): MessageTerm;
|
|
|
210
223
|
* @since 0.6.0
|
|
211
224
|
*/
|
|
212
225
|
declare function commandLine(commandLine: string): MessageTerm;
|
|
226
|
+
/**
|
|
227
|
+
* Creates a {@link MessageTerm} for a URL.
|
|
228
|
+
* @param url The URL, which can be a URL object or a string that can be parsed
|
|
229
|
+
* as a URL. For example, `"https://example.com"` or
|
|
230
|
+
* `new URL("https://example.com")`.
|
|
231
|
+
* @returns A {@link MessageTerm} representing the URL.
|
|
232
|
+
* @throws {RangeError} If the URL string cannot be parsed.
|
|
233
|
+
* @since 0.10.0
|
|
234
|
+
*/
|
|
235
|
+
declare function url(url: string | URL): MessageTerm;
|
|
236
|
+
/**
|
|
237
|
+
* Creates a {@link MessageTerm} for a URL (alias for {@link url}).
|
|
238
|
+
*
|
|
239
|
+
* This is an alias for the {@link url} function, provided for convenience
|
|
240
|
+
* when you want to avoid potential naming conflicts with the `url()` value
|
|
241
|
+
* parser from `@optique/core/valueparser`.
|
|
242
|
+
*
|
|
243
|
+
* @param href The URL, which can be a URL object or a string that can be parsed
|
|
244
|
+
* as a URL. For example, `"https://example.com"` or
|
|
245
|
+
* `new URL("https://example.com")`.
|
|
246
|
+
* @returns A {@link MessageTerm} representing the URL.
|
|
247
|
+
* @throws {RangeError} If the URL string cannot be parsed.
|
|
248
|
+
* @since 0.10.0
|
|
249
|
+
*/
|
|
250
|
+
declare function link(href: string | URL): MessageTerm;
|
|
213
251
|
/**
|
|
214
252
|
* Options for the {@link valueSet} function.
|
|
215
253
|
* @since 0.9.0
|
|
@@ -323,4 +361,4 @@ interface MessageFormatOptions {
|
|
|
323
361
|
*/
|
|
324
362
|
declare function formatMessage(msg: Message, options?: MessageFormatOptions): string;
|
|
325
363
|
//#endregion
|
|
326
|
-
export { Message, MessageFormatOptions, MessageTerm, ValueSetOptions, commandLine, envVar, formatMessage, message, metavar, optionName, optionNames, text, value, valueSet, values };
|
|
364
|
+
export { Message, MessageFormatOptions, MessageTerm, ValueSetOptions, commandLine, envVar, formatMessage, link, message, metavar, optionName, optionNames, text, url, value, valueSet, values };
|
package/dist/message.js
CHANGED
|
@@ -139,6 +139,43 @@ function commandLine(commandLine$1) {
|
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
|
+
* Creates a {@link MessageTerm} for a URL.
|
|
143
|
+
* @param url The URL, which can be a URL object or a string that can be parsed
|
|
144
|
+
* as a URL. For example, `"https://example.com"` or
|
|
145
|
+
* `new URL("https://example.com")`.
|
|
146
|
+
* @returns A {@link MessageTerm} representing the URL.
|
|
147
|
+
* @throws {RangeError} If the URL string cannot be parsed.
|
|
148
|
+
* @since 0.10.0
|
|
149
|
+
*/
|
|
150
|
+
function url(url$1) {
|
|
151
|
+
let urlObj;
|
|
152
|
+
if (typeof url$1 === "string") {
|
|
153
|
+
if (!URL.canParse(url$1)) throw new RangeError(`Invalid URL: ${url$1}.`);
|
|
154
|
+
urlObj = new URL(url$1);
|
|
155
|
+
} else urlObj = url$1;
|
|
156
|
+
return {
|
|
157
|
+
type: "url",
|
|
158
|
+
url: urlObj
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Creates a {@link MessageTerm} for a URL (alias for {@link url}).
|
|
163
|
+
*
|
|
164
|
+
* This is an alias for the {@link url} function, provided for convenience
|
|
165
|
+
* when you want to avoid potential naming conflicts with the `url()` value
|
|
166
|
+
* parser from `@optique/core/valueparser`.
|
|
167
|
+
*
|
|
168
|
+
* @param href The URL, which can be a URL object or a string that can be parsed
|
|
169
|
+
* as a URL. For example, `"https://example.com"` or
|
|
170
|
+
* `new URL("https://example.com")`.
|
|
171
|
+
* @returns A {@link MessageTerm} representing the URL.
|
|
172
|
+
* @throws {RangeError} If the URL string cannot be parsed.
|
|
173
|
+
* @since 0.10.0
|
|
174
|
+
*/
|
|
175
|
+
function link(href) {
|
|
176
|
+
return url(href);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
142
179
|
* Creates a {@link Message} for a formatted list of values using the
|
|
143
180
|
* `Intl.ListFormat` API. This is useful for displaying choice lists
|
|
144
181
|
* in error messages with proper locale-aware formatting.
|
|
@@ -294,6 +331,19 @@ function formatMessage(msg, options = {}) {
|
|
|
294
331
|
text: useColors ? `\x1b[36m${cmd}${resetSequence}` : cmd,
|
|
295
332
|
width: cmd.length
|
|
296
333
|
};
|
|
334
|
+
} else if (term.type === "url") {
|
|
335
|
+
const urlString = term.url.href;
|
|
336
|
+
const displayText = useQuotes ? `<${urlString}>` : urlString;
|
|
337
|
+
if (useColors) {
|
|
338
|
+
const hyperlink = `\x1b]8;;${urlString}\x1b\\${displayText}\x1b]8;;\x1b\\${resetSuffix}`;
|
|
339
|
+
yield {
|
|
340
|
+
text: hyperlink,
|
|
341
|
+
width: displayText.length
|
|
342
|
+
};
|
|
343
|
+
} else yield {
|
|
344
|
+
text: displayText,
|
|
345
|
+
width: displayText.length
|
|
346
|
+
};
|
|
297
347
|
} else throw new TypeError(`Invalid MessageTerm type: ${term["type"]}.`);
|
|
298
348
|
}
|
|
299
349
|
let output = "";
|
|
@@ -315,4 +365,4 @@ function formatMessage(msg, options = {}) {
|
|
|
315
365
|
}
|
|
316
366
|
|
|
317
367
|
//#endregion
|
|
318
|
-
export { commandLine, envVar, formatMessage, message, metavar, optionName, optionNames, text, value, valueSet, values };
|
|
368
|
+
export { commandLine, envVar, formatMessage, link, message, metavar, optionName, optionNames, text, url, value, valueSet, values };
|