gunshi 0.37.1 → 0.37.2
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/lib/bone.d.ts +2 -2
- package/lib/bone.js +1 -1
- package/lib/{cli-8lpU57Wl.js → cli-xU__0QWJ.js} +6 -5
- package/lib/combinators.d.ts +17 -8
- package/lib/combinators.js +9 -7
- package/lib/context.d.ts +2 -2
- package/lib/{core-vmpEqkpT.js → core-Ce6x0is5.js} +25 -24
- package/lib/definition.d.ts +2 -2
- package/lib/{error-BxeGn0JU.js → error-CBijJN5L.js} +2 -2
- package/lib/{error-DdRv50OI.d.ts → error-Ck8cJsi0.d.ts} +1 -1
- package/lib/generator.d.ts +1 -1
- package/lib/generator.js +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +5 -5
- package/lib/{plugin-BY44BdcY.js → plugin-Cvf6mYto.js} +1 -1
- package/lib/plugin.d.ts +3 -3
- package/lib/plugin.js +3 -3
- package/lib/renderer.d.ts +1 -1
- package/lib/renderer.js +1 -1
- package/lib/{resolver-CKLHkuQa.d.ts → resolver-D7DEcpu-.d.ts} +9 -9
- package/lib/{resolver-UjEQwV-U.js → resolver-dsINFnU2.js} +43 -37
- package/lib/{src-a-JpaUM5.js → src-yiBqxwCm.js} +8 -7
- package/lib/{types-8Qh1S2q6.d.ts → types-CdM9C6VD.d.ts} +1 -1
- package/lib/{utils-CfOBA5zn.js → utils-oPJNnmOb.js} +1 -1
- package/lib/utils.d.ts +2 -2
- package/lib/utils.js +1 -1
- package/package.json +7 -7
package/lib/bone.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as Args, n as ArgSchema, r as ArgValues, u as ArgToken } from "./resolver-
|
|
2
|
-
import { C as NormalizeToGunshiParams, D as SubCommandable, E as RenderingOptions, O as ValidationErrorsDecorator, S as MergeGunshiExtensions, T as RendererDecorator, _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, c as CommandDecorator, d as CommandLoader, f as CommandRunner, g as ExtractArgExplicitlyProvided, h as ExtendContext, i as CommandCallMode, l as CommandEnvironment, m as DefaultGunshiParams, n as CliOptions, o as CommandContextCore, p as Commandable, r as Command, s as CommandContextExtension, t as Awaitable, u as CommandExamplesFetcher, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-
|
|
1
|
+
import { i as Args, n as ArgSchema, r as ArgValues, u as ArgToken } from "./resolver-D7DEcpu-.js";
|
|
2
|
+
import { C as NormalizeToGunshiParams, D as SubCommandable, E as RenderingOptions, O as ValidationErrorsDecorator, S as MergeGunshiExtensions, T as RendererDecorator, _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, c as CommandDecorator, d as CommandLoader, f as CommandRunner, g as ExtractArgExplicitlyProvided, h as ExtendContext, i as CommandCallMode, l as CommandEnvironment, m as DefaultGunshiParams, n as CliOptions, o as CommandContextCore, p as Commandable, r as Command, s as CommandContextExtension, t as Awaitable, u as CommandExamplesFetcher, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-CdM9C6VD.js";
|
|
3
3
|
|
|
4
4
|
//#region src/cli/bone.d.ts
|
|
5
5
|
/**
|
package/lib/bone.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as hasPriorityValidationError } from "./error-
|
|
2
|
-
import { t as plugin } from "./plugin-
|
|
3
|
-
import { a as namespacedId, o as COMMON_ARGS, t as renderer } from "./src-
|
|
4
|
-
import { t as cliCore } from "./core-
|
|
1
|
+
import { r as hasPriorityValidationError } from "./error-CBijJN5L.js";
|
|
2
|
+
import { t as plugin } from "./plugin-Cvf6mYto.js";
|
|
3
|
+
import { a as namespacedId, o as COMMON_ARGS, t as renderer } from "./src-yiBqxwCm.js";
|
|
4
|
+
import { t as cliCore } from "./core-Ce6x0is5.js";
|
|
5
5
|
//#region ../plugin-global/src/types.ts
|
|
6
6
|
/**
|
|
7
7
|
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
@@ -160,7 +160,8 @@ function global() {
|
|
|
160
160
|
* @returns A rendered usage or undefined. if you will use {@linkcode CliOptions.usageSilent} option, it will return rendered usage string.
|
|
161
161
|
*/
|
|
162
162
|
async function cli(args, entry, options = {}) {
|
|
163
|
-
|
|
163
|
+
const builtInPlugins = [global(), renderer()];
|
|
164
|
+
return cliCore(args, entry, options, builtInPlugins);
|
|
164
165
|
}
|
|
165
166
|
//#endregion
|
|
166
167
|
//#region src/cli.ts
|
package/lib/combinators.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as Args, n as ArgSchema } from "./resolver-
|
|
1
|
+
import { i as Args, n as ArgSchema } from "./resolver-D7DEcpu-.js";
|
|
2
2
|
|
|
3
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
3
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/combinators.d.ts
|
|
4
4
|
|
|
5
5
|
//#region src/combinators.d.ts
|
|
6
6
|
/**
|
|
@@ -391,6 +391,13 @@ type CombinatorWithDefault<T> = {
|
|
|
391
391
|
* @experimental
|
|
392
392
|
*/
|
|
393
393
|
declare function withDefault<T extends string | boolean | number>(schema: CombinatorSchema<T>, defaultValue: T): CombinatorSchema<T> & CombinatorWithDefault<T>;
|
|
394
|
+
/**
|
|
395
|
+
* Overlay a flag onto a combinator schema without dropping other modifiers.
|
|
396
|
+
*
|
|
397
|
+
* Omits the flag keys from `S` first so optional `ArgSchema` fields
|
|
398
|
+
* (`multiple?: true`, `required?: boolean`) cannot stay as unions.
|
|
399
|
+
*/
|
|
400
|
+
type WithFlag<S, F> = Omit<S, keyof F> & F;
|
|
394
401
|
/**
|
|
395
402
|
* Options for the {@link multiple} combinator.
|
|
396
403
|
*/
|
|
@@ -401,10 +408,11 @@ type CombinatorMultiple = {
|
|
|
401
408
|
* Mark a combinator schema as accepting multiple values.
|
|
402
409
|
*
|
|
403
410
|
* The resolved value becomes an array. The original schema is not modified.
|
|
411
|
+
* Other modifiers on `schema` (for example {@link required}) are kept.
|
|
404
412
|
*
|
|
405
|
-
* @typeParam
|
|
413
|
+
* @typeParam S - The input combinator schema.
|
|
406
414
|
* @param schema - The base combinator schema.
|
|
407
|
-
* @returns A
|
|
415
|
+
* @returns A copy of `schema` with `multiple: true`.
|
|
408
416
|
*
|
|
409
417
|
* @example
|
|
410
418
|
* ```ts
|
|
@@ -416,7 +424,7 @@ type CombinatorMultiple = {
|
|
|
416
424
|
*
|
|
417
425
|
* @experimental
|
|
418
426
|
*/
|
|
419
|
-
declare function multiple<
|
|
427
|
+
declare function multiple<S extends CombinatorSchema<unknown>>(schema: S): WithFlag<S, CombinatorMultiple>;
|
|
420
428
|
/**
|
|
421
429
|
* Options for the {@link required} combinator.
|
|
422
430
|
*/
|
|
@@ -427,11 +435,12 @@ type CombinatorRequired = {
|
|
|
427
435
|
* Mark a combinator schema as required.
|
|
428
436
|
*
|
|
429
437
|
* The original schema is not modified.
|
|
438
|
+
* Other modifiers on `schema` (for example {@link multiple}) are kept.
|
|
430
439
|
*
|
|
431
|
-
* @typeParam
|
|
440
|
+
* @typeParam S - The input combinator schema.
|
|
432
441
|
*
|
|
433
442
|
* @param schema - The base combinator schema.
|
|
434
|
-
* @returns A
|
|
443
|
+
* @returns A copy of `schema` with `required: true`.
|
|
435
444
|
*
|
|
436
445
|
* @example
|
|
437
446
|
* ```ts
|
|
@@ -442,7 +451,7 @@ type CombinatorRequired = {
|
|
|
442
451
|
*
|
|
443
452
|
* @experimental
|
|
444
453
|
*/
|
|
445
|
-
declare function required<
|
|
454
|
+
declare function required<S extends CombinatorSchema<unknown>>(schema: S): WithFlag<S, CombinatorRequired>;
|
|
446
455
|
/**
|
|
447
456
|
* Options for the {@link short} combinator.
|
|
448
457
|
*/
|
package/lib/combinators.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as formatChoices } from "./utils-
|
|
2
|
-
import { n as ArgsValidationErrorKeys, t as ArgsValidationError } from "./resolver-
|
|
3
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
1
|
+
import { t as formatChoices } from "./utils-oPJNnmOb.js";
|
|
2
|
+
import { n as ArgsValidationErrorKeys, t as ArgsValidationError } from "./resolver-dsINFnU2.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/combinators.js
|
|
4
4
|
/**
|
|
5
5
|
* Parser combinator factory functions for composable argument schema construction.
|
|
6
6
|
*
|
|
@@ -412,10 +412,11 @@ function withDefault(schema, defaultValue) {
|
|
|
412
412
|
* Mark a combinator schema as accepting multiple values.
|
|
413
413
|
*
|
|
414
414
|
* The resolved value becomes an array. The original schema is not modified.
|
|
415
|
+
* Other modifiers on `schema` (for example {@link required}) are kept.
|
|
415
416
|
*
|
|
416
|
-
* @typeParam
|
|
417
|
+
* @typeParam S - The input combinator schema.
|
|
417
418
|
* @param schema - The base combinator schema.
|
|
418
|
-
* @returns A
|
|
419
|
+
* @returns A copy of `schema` with `multiple: true`.
|
|
419
420
|
*
|
|
420
421
|
* @example
|
|
421
422
|
* ```ts
|
|
@@ -438,11 +439,12 @@ function multiple(schema) {
|
|
|
438
439
|
* Mark a combinator schema as required.
|
|
439
440
|
*
|
|
440
441
|
* The original schema is not modified.
|
|
442
|
+
* Other modifiers on `schema` (for example {@link multiple}) are kept.
|
|
441
443
|
*
|
|
442
|
-
* @typeParam
|
|
444
|
+
* @typeParam S - The input combinator schema.
|
|
443
445
|
*
|
|
444
446
|
* @param schema - The base combinator schema.
|
|
445
|
-
* @returns A
|
|
447
|
+
* @returns A copy of `schema` with `required: true`.
|
|
446
448
|
*
|
|
447
449
|
* @example
|
|
448
450
|
* ```ts
|
package/lib/context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as Args, r as ArgValues, u as ArgToken } from "./resolver-
|
|
2
|
-
import { _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, g as ExtractArgExplicitlyProvided, h as ExtendContext, i as CommandCallMode, m as DefaultGunshiParams, n as CliOptions, r as Command, s as CommandContextExtension, x as LazyCommand, y as GunshiParams } from "./types-
|
|
1
|
+
import { i as Args, r as ArgValues, u as ArgToken } from "./resolver-D7DEcpu-.js";
|
|
2
|
+
import { _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, g as ExtractArgExplicitlyProvided, h as ExtendContext, i as CommandCallMode, m as DefaultGunshiParams, n as CliOptions, r as Command, s as CommandContextExtension, x as LazyCommand, y as GunshiParams } from "./types-CdM9C6VD.js";
|
|
3
3
|
|
|
4
4
|
//#region src/context.d.ts
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as NOOP, r as CLI_OPTIONS_DEFAULT, t as createCommandContext } from "./context-CAPhwgJJ.js";
|
|
2
|
-
import { n as kebabnize } from "./utils-
|
|
2
|
+
import { n as kebabnize } from "./utils-oPJNnmOb.js";
|
|
3
3
|
import { create, getCommandSubCommands, isLazyCommand, resolveLazyCommand } from "./utils.js";
|
|
4
|
-
import { a as parseArgs, i as resolveArgs, n as ArgsValidationErrorKeys, t as ArgsValidationError } from "./resolver-
|
|
5
|
-
import { n as CommandNotFoundErrorKeys, r as hasPriorityValidationError, t as CommandNotFoundError } from "./error-
|
|
4
|
+
import { a as parseArgs, i as resolveArgs, n as ArgsValidationErrorKeys, t as ArgsValidationError } from "./resolver-dsINFnU2.js";
|
|
5
|
+
import { n as CommandNotFoundErrorKeys, r as hasPriorityValidationError, t as CommandNotFoundError } from "./error-CBijJN5L.js";
|
|
6
6
|
//#region src/decorators.ts
|
|
7
7
|
/**
|
|
8
8
|
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
@@ -361,27 +361,28 @@ function getPositionalTokens(tokens) {
|
|
|
361
361
|
function resolveCommandTree(tokens, entry, options) {
|
|
362
362
|
const positionals = getPositionalTokens(tokens);
|
|
363
363
|
function resolveAsEntry() {
|
|
364
|
-
if (typeof entry === "function")
|
|
365
|
-
commandName
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
364
|
+
if (typeof entry === "function") {
|
|
365
|
+
if ("commandName" in entry && entry.commandName) return {
|
|
366
|
+
commandName: entry.commandName,
|
|
367
|
+
command: entry,
|
|
368
|
+
callMode: "entry",
|
|
369
|
+
commandPath: [],
|
|
370
|
+
depth: 0,
|
|
371
|
+
omitted: options.subCommands.size > 0 && !positionals[0],
|
|
372
|
+
levelSubCommands: options.subCommands.size > 0 ? options.subCommands : void 0
|
|
373
|
+
};
|
|
374
|
+
else return {
|
|
375
|
+
command: {
|
|
376
|
+
run: entry,
|
|
377
|
+
entry: true
|
|
378
|
+
},
|
|
379
|
+
callMode: "entry",
|
|
380
|
+
commandPath: [],
|
|
381
|
+
depth: 0,
|
|
382
|
+
omitted: options.subCommands.size > 0 && !positionals[0],
|
|
383
|
+
levelSubCommands: options.subCommands.size > 0 ? options.subCommands : void 0
|
|
384
|
+
};
|
|
385
|
+
} else if (typeof entry === "object") return {
|
|
385
386
|
commandName: resolveEntryName(entry),
|
|
386
387
|
command: entry,
|
|
387
388
|
callMode: "entry",
|
package/lib/definition.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as Args, n as ArgSchema, r as ArgValues } from "./resolver-
|
|
2
|
-
import { C as NormalizeToGunshiParams, _ as ExtractArgs, b as GunshiParamsConstraint, d as CommandLoader, f as CommandRunner, h as ExtendContext, m as DefaultGunshiParams, r as Command, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-
|
|
1
|
+
import { i as Args, n as ArgSchema, r as ArgValues } from "./resolver-D7DEcpu-.js";
|
|
2
|
+
import { C as NormalizeToGunshiParams, _ as ExtractArgs, b as GunshiParamsConstraint, d as CommandLoader, f as CommandRunner, h as ExtendContext, m as DefaultGunshiParams, r as Command, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-CdM9C6VD.js";
|
|
3
3
|
import { CommandContextParams, createCommandContext } from "./context.js";
|
|
4
4
|
|
|
5
5
|
//#region src/definition.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as ArgsValidationErrorKeys, r as isArgsValidationError } from "./resolver-
|
|
2
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
1
|
+
import { n as ArgsValidationErrorKeys, r as isArgsValidationError } from "./resolver-dsINFnU2.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/index.js
|
|
3
3
|
/**
|
|
4
4
|
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
5
5
|
* @license MIT
|
package/lib/generator.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as GunshiParamsConstraint, m as DefaultGunshiParams, n as CliOptions, r as Command, x as LazyCommand } from "./types-
|
|
1
|
+
import { b as GunshiParamsConstraint, m as DefaultGunshiParams, n as CliOptions, r as Command, x as LazyCommand } from "./types-CdM9C6VD.js";
|
|
2
2
|
|
|
3
3
|
//#region src/generator.d.ts
|
|
4
4
|
|
package/lib/generator.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as ArgsValidationError, c as isArgsValidationError, d as parseArgs, i as Args, l as resolveArgs, n as ArgSchema, o as ArgsValidationErrorCode, r as ArgValues, s as ArgsValidationErrorKeys, u as ArgToken } from "./resolver-
|
|
2
|
-
import { A as Plugin, C as NormalizeToGunshiParams, D as SubCommandable, E as RenderingOptions, F as PluginWithExtension, I as PluginWithoutExtension, L as plugin, M as PluginExtension, N as PluginFunction, O as ValidationErrorsDecorator, P as PluginOptions, R as PluginContext, S as MergeGunshiExtensions, T as RendererDecorator, _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, c as CommandDecorator, d as CommandLoader, f as CommandRunner, g as ExtractArgExplicitlyProvided, h as ExtendContext, i as CommandCallMode, j as PluginDependency, k as OnPluginExtension, l as CommandEnvironment, m as DefaultGunshiParams, n as CliOptions, o as CommandContextCore, p as Commandable, r as Command, s as CommandContextExtension, t as Awaitable, u as CommandExamplesFetcher, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-
|
|
1
|
+
import { a as ArgsValidationError, c as isArgsValidationError, d as parseArgs, i as Args, l as resolveArgs, n as ArgSchema, o as ArgsValidationErrorCode, r as ArgValues, s as ArgsValidationErrorKeys, u as ArgToken } from "./resolver-D7DEcpu-.js";
|
|
2
|
+
import { A as Plugin, C as NormalizeToGunshiParams, D as SubCommandable, E as RenderingOptions, F as PluginWithExtension, I as PluginWithoutExtension, L as plugin, M as PluginExtension, N as PluginFunction, O as ValidationErrorsDecorator, P as PluginOptions, R as PluginContext, S as MergeGunshiExtensions, T as RendererDecorator, _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, c as CommandDecorator, d as CommandLoader, f as CommandRunner, g as ExtractArgExplicitlyProvided, h as ExtendContext, i as CommandCallMode, j as PluginDependency, k as OnPluginExtension, l as CommandEnvironment, m as DefaultGunshiParams, n as CliOptions, o as CommandContextCore, p as Commandable, r as Command, s as CommandContextExtension, t as Awaitable, u as CommandExamplesFetcher, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-CdM9C6VD.js";
|
|
3
3
|
import { CommandContextParams, createCommandContext } from "./context.js";
|
|
4
4
|
import { define, defineWithTypes, lazy, lazyWithTypes } from "./definition.js";
|
|
5
|
-
import { a as hasPriorityValidationError, i as CommandNotFoundErrorOptions, n as CommandNotFoundErrorCode, o as isCommandNotFoundError, r as CommandNotFoundErrorKeys, s as ANONYMOUS_COMMAND_NAME, t as CommandNotFoundError } from "./error-
|
|
5
|
+
import { a as hasPriorityValidationError, i as CommandNotFoundErrorOptions, n as CommandNotFoundErrorCode, o as isCommandNotFoundError, r as CommandNotFoundErrorKeys, s as ANONYMOUS_COMMAND_NAME, t as CommandNotFoundError } from "./error-Ck8cJsi0.js";
|
|
6
6
|
|
|
7
7
|
//#region ../plugin-i18n/src/types.d.ts
|
|
8
8
|
/**
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as ANONYMOUS_COMMAND_NAME, t as createCommandContext } from "./context-CAPhwgJJ.js";
|
|
2
|
-
import { a as parseArgs, i as resolveArgs, n as ArgsValidationErrorKeys, r as isArgsValidationError, t as ArgsValidationError } from "./resolver-
|
|
3
|
-
import { i as isCommandNotFoundError, n as CommandNotFoundErrorKeys, r as hasPriorityValidationError, t as CommandNotFoundError } from "./error-
|
|
4
|
-
import { t as plugin } from "./plugin-
|
|
5
|
-
import { a as namespacedId } from "./src-
|
|
6
|
-
import { t as cli } from "./cli-
|
|
2
|
+
import { a as parseArgs, i as resolveArgs, n as ArgsValidationErrorKeys, r as isArgsValidationError, t as ArgsValidationError } from "./resolver-dsINFnU2.js";
|
|
3
|
+
import { i as isCommandNotFoundError, n as CommandNotFoundErrorKeys, r as hasPriorityValidationError, t as CommandNotFoundError } from "./error-CBijJN5L.js";
|
|
4
|
+
import { t as plugin } from "./plugin-Cvf6mYto.js";
|
|
5
|
+
import { a as namespacedId } from "./src-yiBqxwCm.js";
|
|
6
|
+
import { t as cli } from "./cli-xU__0QWJ.js";
|
|
7
7
|
import { define, defineWithTypes, lazy, lazyWithTypes } from "./definition.js";
|
|
8
8
|
//#region ../plugin-i18n/src/translation.ts
|
|
9
9
|
/**
|
package/lib/plugin.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as ArgsValidationError, c as isArgsValidationError, i as Args, n as ArgSchema, o as ArgsValidationErrorCode, r as ArgValues, s as ArgsValidationErrorKeys, u as ArgToken } from "./resolver-
|
|
2
|
-
import { A as Plugin, C as NormalizeToGunshiParams, F as PluginWithExtension, I as PluginWithoutExtension, L as plugin, M as PluginExtension, N as PluginFunction, O as ValidationErrorsDecorator, P as PluginOptions, R as PluginContext, S as MergeGunshiExtensions, T as RendererDecorator, _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, c as CommandDecorator, f as CommandRunner, h as ExtendContext, j as PluginDependency, k as OnPluginExtension, m as DefaultGunshiParams, o as CommandContextCore, r as Command, s as CommandContextExtension, t as Awaitable, u as CommandExamplesFetcher, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-
|
|
1
|
+
import { a as ArgsValidationError, c as isArgsValidationError, i as Args, n as ArgSchema, o as ArgsValidationErrorCode, r as ArgValues, s as ArgsValidationErrorKeys, u as ArgToken } from "./resolver-D7DEcpu-.js";
|
|
2
|
+
import { A as Plugin, C as NormalizeToGunshiParams, F as PluginWithExtension, I as PluginWithoutExtension, L as plugin, M as PluginExtension, N as PluginFunction, O as ValidationErrorsDecorator, P as PluginOptions, R as PluginContext, S as MergeGunshiExtensions, T as RendererDecorator, _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, c as CommandDecorator, f as CommandRunner, h as ExtendContext, j as PluginDependency, k as OnPluginExtension, m as DefaultGunshiParams, o as CommandContextCore, r as Command, s as CommandContextExtension, t as Awaitable, u as CommandExamplesFetcher, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-CdM9C6VD.js";
|
|
3
3
|
import { CommandContextParams, createCommandContext } from "./context.js";
|
|
4
|
-
import { a as hasPriorityValidationError, c as CLI_OPTIONS_DEFAULT, i as CommandNotFoundErrorOptions, n as CommandNotFoundErrorCode, o as isCommandNotFoundError, r as CommandNotFoundErrorKeys, s as ANONYMOUS_COMMAND_NAME, t as CommandNotFoundError } from "./error-
|
|
4
|
+
import { a as hasPriorityValidationError, c as CLI_OPTIONS_DEFAULT, i as CommandNotFoundErrorOptions, n as CommandNotFoundErrorCode, o as isCommandNotFoundError, r as CommandNotFoundErrorKeys, s as ANONYMOUS_COMMAND_NAME, t as CommandNotFoundError } from "./error-Ck8cJsi0.js";
|
|
5
5
|
|
|
6
6
|
//#region src/plugin.d.ts
|
|
7
7
|
/**
|
package/lib/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ANONYMOUS_COMMAND_NAME, r as CLI_OPTIONS_DEFAULT, t as createCommandContext } from "./context-CAPhwgJJ.js";
|
|
2
|
-
import { n as ArgsValidationErrorKeys, r as isArgsValidationError, t as ArgsValidationError } from "./resolver-
|
|
3
|
-
import { i as isCommandNotFoundError, n as CommandNotFoundErrorKeys, r as hasPriorityValidationError, t as CommandNotFoundError } from "./error-
|
|
4
|
-
import { t as plugin } from "./plugin-
|
|
2
|
+
import { n as ArgsValidationErrorKeys, r as isArgsValidationError, t as ArgsValidationError } from "./resolver-dsINFnU2.js";
|
|
3
|
+
import { i as isCommandNotFoundError, n as CommandNotFoundErrorKeys, r as hasPriorityValidationError, t as CommandNotFoundError } from "./error-CBijJN5L.js";
|
|
4
|
+
import { t as plugin } from "./plugin-Cvf6mYto.js";
|
|
5
5
|
export { ANONYMOUS_COMMAND_NAME, ArgsValidationError, ArgsValidationErrorKeys, CLI_OPTIONS_DEFAULT, CommandNotFoundError, CommandNotFoundErrorKeys, createCommandContext, hasPriorityValidationError, isArgsValidationError, isCommandNotFoundError, plugin };
|
package/lib/renderer.d.ts
CHANGED
package/lib/renderer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as renderHeader, n as renderValidationErrors, r as renderUsage } from "./src-
|
|
1
|
+
import { i as renderHeader, n as renderValidationErrors, r as renderUsage } from "./src-yiBqxwCm.js";
|
|
2
2
|
//#region src/renderer.ts
|
|
3
3
|
/**
|
|
4
4
|
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
1
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/parser-DT7Ztcch.d.ts
|
|
2
2
|
//#region src/parser.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Entry point of argument parser.
|
|
@@ -88,7 +88,7 @@ declare function parseArgs(args: string[], options?: ParserOptions): ArgToken[];
|
|
|
88
88
|
* @returns Whether `arg` is a short option.
|
|
89
89
|
*/
|
|
90
90
|
//#endregion
|
|
91
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
91
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/resolver.d.ts
|
|
92
92
|
//#region src/resolver.d.ts
|
|
93
93
|
/**
|
|
94
94
|
* An argument schema definition for command-line argument parsing.
|
|
@@ -548,12 +548,12 @@ interface ArgSchema {
|
|
|
548
548
|
* i18n resource key for localized rendering.
|
|
549
549
|
*/
|
|
550
550
|
declare const ArgsValidationErrorKeys: {
|
|
551
|
-
readonly requiredOption:
|
|
552
|
-
readonly requiredPositional:
|
|
553
|
-
readonly invalidType:
|
|
554
|
-
readonly invalidChoice:
|
|
555
|
-
readonly customParse:
|
|
556
|
-
readonly unknownOption:
|
|
551
|
+
readonly requiredOption: 'err:arg:required-option';
|
|
552
|
+
readonly requiredPositional: 'err:arg:required-positional';
|
|
553
|
+
readonly invalidType: 'err:arg:invalid-type';
|
|
554
|
+
readonly invalidChoice: 'err:arg:invalid-choice';
|
|
555
|
+
readonly customParse: 'err:arg:custom-parse';
|
|
556
|
+
readonly unknownOption: 'err:arg:unknown-option';
|
|
557
557
|
};
|
|
558
558
|
/**
|
|
559
559
|
* A machine-readable argument validation error code.
|
|
@@ -632,7 +632,7 @@ type ResolveOptionValue<A extends ArgSchema, T> = A['multiple'] extends true ? T
|
|
|
632
632
|
*
|
|
633
633
|
* @internal
|
|
634
634
|
*/
|
|
635
|
-
type ResolveArgValues<A extends Args, V extends Record<keyof A, unknown>> = { -readonly [Arg in keyof A]?: V[Arg] } & FilterArgs<A, V, 'default'> & FilterArgs<A, V, 'required'> & FilterPositionalArgs<A, V> extends infer P ? { [K in keyof P]: P[K] } : never;
|
|
635
|
+
type ResolveArgValues<A extends Args, V extends Record<keyof A, unknown>> = { -readonly [Arg in keyof A]?: V[Arg] } & FilterArgs<A, V, 'default'> & FilterArgs<A, V, 'required'> & FilterPositionalArgs<A, V> extends (infer P) ? { [K in keyof P]: P[K] } : never;
|
|
636
636
|
/**
|
|
637
637
|
* Filters the arguments based on their default values.
|
|
638
638
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as kebabnize, t as formatChoices } from "./utils-
|
|
2
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
1
|
+
import { n as kebabnize, t as formatChoices } from "./utils-oPJNnmOb.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/parser.js
|
|
3
3
|
/**
|
|
4
4
|
* forked from `nodejs/node` (`pkgjs/parseargs`)
|
|
5
5
|
* repository url: https://github.com/nodejs/node (https://github.com/pkgjs/parseargs)
|
|
@@ -204,7 +204,7 @@ function hasOptionValue(value) {
|
|
|
204
204
|
return !(value == null) && value.codePointAt(0) !== HYPHEN_CODE;
|
|
205
205
|
}
|
|
206
206
|
//#endregion
|
|
207
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
207
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/resolver.js
|
|
208
208
|
/**
|
|
209
209
|
* Entry point of argument options resolver.
|
|
210
210
|
*
|
|
@@ -359,46 +359,52 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
|
|
|
359
359
|
rest.push(token.value);
|
|
360
360
|
continue;
|
|
361
361
|
}
|
|
362
|
-
if (currentShortOption)
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
362
|
+
if (currentShortOption) {
|
|
363
|
+
if (schemas.find((schema) => schema.short === currentShortOption.name && schema.type === "boolean")) {
|
|
364
|
+
positionalTokens.push({ ...token });
|
|
365
|
+
applyShortOptionValue();
|
|
366
|
+
} else applyShortOptionValue(token.value);
|
|
367
|
+
} else if (currentLongOption) {
|
|
368
|
+
if (booleanLongOptionNames.has(currentLongOption.name)) {
|
|
369
|
+
positionalTokens.push({ ...token });
|
|
370
|
+
applyLongOptionValue();
|
|
371
|
+
} else applyLongOptionValue(token.value);
|
|
372
|
+
} else positionalTokens.push({ ...token });
|
|
373
|
+
} else if (token.kind === "option") {
|
|
374
|
+
if (token.rawName) {
|
|
375
|
+
if (hasLongOptionPrefix(token.rawName)) {
|
|
376
|
+
applyLongOptionValue();
|
|
377
|
+
if (token.inlineValue) optionTokens.push({ ...token });
|
|
378
|
+
else currentLongOption = { ...token };
|
|
379
|
+
applyShortOptionValue();
|
|
380
|
+
} else if (isShortOption(token.rawName)) {
|
|
381
|
+
if (currentShortOption) {
|
|
382
|
+
if (currentShortOption.index === token.index) {
|
|
383
|
+
if (shortGrouping) {
|
|
384
|
+
currentShortOption.value = token.value;
|
|
385
|
+
optionTokens.push({ ...currentShortOption });
|
|
386
|
+
currentShortOption = { ...token };
|
|
387
|
+
} else expandableShortOptions.push({ ...token });
|
|
388
|
+
} else {
|
|
389
|
+
currentShortOption.value = toShortValue();
|
|
390
|
+
optionTokens.push({ ...currentShortOption });
|
|
391
|
+
currentShortOption = { ...token };
|
|
392
|
+
}
|
|
393
|
+
applyLongOptionValue();
|
|
394
|
+
} else {
|
|
395
|
+
currentShortOption = { ...token };
|
|
396
|
+
applyLongOptionValue();
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
} else {
|
|
400
|
+
if (currentShortOption && currentShortOption.index == token.index && token.inlineValue) {
|
|
379
401
|
currentShortOption.value = token.value;
|
|
380
402
|
optionTokens.push({ ...currentShortOption });
|
|
381
|
-
currentShortOption =
|
|
382
|
-
} else expandableShortOptions.push({ ...token });
|
|
383
|
-
else {
|
|
384
|
-
currentShortOption.value = toShortValue();
|
|
385
|
-
optionTokens.push({ ...currentShortOption });
|
|
386
|
-
currentShortOption = { ...token };
|
|
403
|
+
currentShortOption = void 0;
|
|
387
404
|
}
|
|
388
405
|
applyLongOptionValue();
|
|
389
|
-
} else {
|
|
390
|
-
currentShortOption = { ...token };
|
|
391
|
-
applyLongOptionValue();
|
|
392
406
|
}
|
|
393
407
|
} else {
|
|
394
|
-
if (currentShortOption && currentShortOption.index == token.index && token.inlineValue) {
|
|
395
|
-
currentShortOption.value = token.value;
|
|
396
|
-
optionTokens.push({ ...currentShortOption });
|
|
397
|
-
currentShortOption = void 0;
|
|
398
|
-
}
|
|
399
|
-
applyLongOptionValue();
|
|
400
|
-
}
|
|
401
|
-
else {
|
|
402
408
|
if (token.kind === "option-terminator") terminated = true;
|
|
403
409
|
applyLongOptionValue();
|
|
404
410
|
applyShortOptionValue();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./context-CAPhwgJJ.js";
|
|
2
|
-
import { n as kebabnize } from "./utils-
|
|
2
|
+
import { n as kebabnize } from "./utils-oPJNnmOb.js";
|
|
3
3
|
import { resolveLazyCommand } from "./utils.js";
|
|
4
|
-
import { n as ArgsValidationErrorKeys, r as isArgsValidationError } from "./resolver-
|
|
5
|
-
import { i as isCommandNotFoundError } from "./error-
|
|
6
|
-
import { t as plugin } from "./plugin-
|
|
4
|
+
import { n as ArgsValidationErrorKeys, r as isArgsValidationError } from "./resolver-dsINFnU2.js";
|
|
5
|
+
import { i as isCommandNotFoundError } from "./error-CBijJN5L.js";
|
|
6
|
+
import { t as plugin } from "./plugin-Cvf6mYto.js";
|
|
7
7
|
/**
|
|
8
8
|
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
9
9
|
* @license MIT
|
|
@@ -315,9 +315,10 @@ async function renderUsageSection(ctx) {
|
|
|
315
315
|
}
|
|
316
316
|
async function makeUsageSymbols(ctx) {
|
|
317
317
|
const messages = [await resolveEntry(ctx)];
|
|
318
|
-
if (ctx.omitted)
|
|
319
|
-
|
|
320
|
-
|
|
318
|
+
if (ctx.omitted) {
|
|
319
|
+
if (await hasCommands(ctx)) messages.push(` [${await ctx.extensions[pluginId].text(resolveBuiltInKey("COMMANDS"))}]`);
|
|
320
|
+
else messages.push(`${ctx.callMode === "subCommand" ? ` ${await resolveSubCommand(ctx)}` : ""}`);
|
|
321
|
+
} else messages.push(`${ctx.callMode === "subCommand" ? ` ${await resolveSubCommand(ctx)}` : ""}`);
|
|
321
322
|
const optionsSymbols = await generateOptionsSymbols(ctx, ctx.args);
|
|
322
323
|
if (optionsSymbols) messages.push(" ", optionsSymbols);
|
|
323
324
|
const positionalSymbols = generatePositionalSymbols(ctx.args);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as Args, n as ArgSchema, r as ArgValues, t as ArgExplicitlyProvided, u as ArgToken } from "./resolver-
|
|
1
|
+
import { i as Args, n as ArgSchema, r as ArgValues, t as ArgExplicitlyProvided, u as ArgToken } from "./resolver-D7DEcpu-.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin/context.d.ts
|
|
4
4
|
/**
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as GunshiParamsConstraint, m as DefaultGunshiParams, p as Commandable, r as Command, x as LazyCommand } from "./types-
|
|
1
|
+
import { b as GunshiParamsConstraint, m as DefaultGunshiParams, p as Commandable, r as Command, x as LazyCommand } from "./types-CdM9C6VD.js";
|
|
2
2
|
|
|
3
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
3
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/utils.d.ts
|
|
4
4
|
|
|
5
5
|
//#region src/utils.d.ts
|
|
6
6
|
/**
|
package/lib/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gunshi",
|
|
3
3
|
"description": "Modern javascript command-line library",
|
|
4
|
-
"version": "0.37.
|
|
4
|
+
"version": "0.37.2",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
7
7
|
"email": "kawakazu80@gmail.com"
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"args-tokens": "^0.28.
|
|
111
|
+
"args-tokens": "^0.28.2",
|
|
112
112
|
"deno": "^2.7.14",
|
|
113
113
|
"jsr": "^0.14.3",
|
|
114
114
|
"jsr-exports-lint": "^0.4.2",
|
|
@@ -116,11 +116,11 @@
|
|
|
116
116
|
"std-env": "^4.1.0",
|
|
117
117
|
"tsdown": "0.21.0",
|
|
118
118
|
"zod": "^4.4.3",
|
|
119
|
-
"@gunshi/plugin-i18n": "0.37.
|
|
120
|
-
"@gunshi/plugin-global": "0.37.
|
|
121
|
-
"@gunshi/
|
|
122
|
-
"@gunshi/
|
|
123
|
-
"@gunshi/
|
|
119
|
+
"@gunshi/plugin-i18n": "0.37.2",
|
|
120
|
+
"@gunshi/plugin-global": "0.37.2",
|
|
121
|
+
"@gunshi/resources": "0.37.2",
|
|
122
|
+
"@gunshi/plugin-renderer": "0.37.2",
|
|
123
|
+
"@gunshi/shared": "0.37.2"
|
|
124
124
|
},
|
|
125
125
|
"scripts": {
|
|
126
126
|
"build": "tsdown",
|