@gunshi/bone 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/index.d.ts +3 -3
- package/lib/index.js +66 -59
- package/package.json +5 -5
package/lib/index.d.ts
CHANGED
|
@@ -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.
|
|
@@ -55,7 +55,7 @@ interface ArgToken {
|
|
|
55
55
|
* Parser Options.
|
|
56
56
|
*/
|
|
57
57
|
//#endregion
|
|
58
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
58
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/resolver.d.ts
|
|
59
59
|
//#region src/resolver.d.ts
|
|
60
60
|
/**
|
|
61
61
|
* An argument schema definition for command-line argument parsing.
|
|
@@ -548,7 +548,7 @@ type ResolveOptionValue<A extends ArgSchema, T> = A['multiple'] extends true ? T
|
|
|
548
548
|
*
|
|
549
549
|
* @internal
|
|
550
550
|
*/
|
|
551
|
-
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;
|
|
551
|
+
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;
|
|
552
552
|
/**
|
|
553
553
|
* Filters the arguments based on their default values.
|
|
554
554
|
*
|
package/lib/index.js
CHANGED
|
@@ -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.js
|
|
2
2
|
/**
|
|
3
3
|
* forked from `nodejs/node` (`pkgjs/parseargs`)
|
|
4
4
|
* repository url: https://github.com/nodejs/node (https://github.com/pkgjs/parseargs)
|
|
@@ -203,7 +203,7 @@ function hasOptionValue(value) {
|
|
|
203
203
|
return !(value == null) && value.codePointAt(0) !== HYPHEN_CODE;
|
|
204
204
|
}
|
|
205
205
|
//#endregion
|
|
206
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
206
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/utils.js
|
|
207
207
|
/**
|
|
208
208
|
* Entry point of utils.
|
|
209
209
|
*
|
|
@@ -234,7 +234,7 @@ function formatChoices(choices) {
|
|
|
234
234
|
return choices.map((value) => JSON.stringify(value)).join(", ");
|
|
235
235
|
}
|
|
236
236
|
//#endregion
|
|
237
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
237
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/resolver.js
|
|
238
238
|
/**
|
|
239
239
|
* Entry point of argument options resolver.
|
|
240
240
|
*
|
|
@@ -389,46 +389,52 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
|
|
|
389
389
|
rest.push(token.value);
|
|
390
390
|
continue;
|
|
391
391
|
}
|
|
392
|
-
if (currentShortOption)
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
392
|
+
if (currentShortOption) {
|
|
393
|
+
if (schemas.find((schema) => schema.short === currentShortOption.name && schema.type === "boolean")) {
|
|
394
|
+
positionalTokens.push({ ...token });
|
|
395
|
+
applyShortOptionValue();
|
|
396
|
+
} else applyShortOptionValue(token.value);
|
|
397
|
+
} else if (currentLongOption) {
|
|
398
|
+
if (booleanLongOptionNames.has(currentLongOption.name)) {
|
|
399
|
+
positionalTokens.push({ ...token });
|
|
400
|
+
applyLongOptionValue();
|
|
401
|
+
} else applyLongOptionValue(token.value);
|
|
402
|
+
} else positionalTokens.push({ ...token });
|
|
403
|
+
} else if (token.kind === "option") {
|
|
404
|
+
if (token.rawName) {
|
|
405
|
+
if (hasLongOptionPrefix(token.rawName)) {
|
|
406
|
+
applyLongOptionValue();
|
|
407
|
+
if (token.inlineValue) optionTokens.push({ ...token });
|
|
408
|
+
else currentLongOption = { ...token };
|
|
409
|
+
applyShortOptionValue();
|
|
410
|
+
} else if (isShortOption(token.rawName)) {
|
|
411
|
+
if (currentShortOption) {
|
|
412
|
+
if (currentShortOption.index === token.index) {
|
|
413
|
+
if (shortGrouping) {
|
|
414
|
+
currentShortOption.value = token.value;
|
|
415
|
+
optionTokens.push({ ...currentShortOption });
|
|
416
|
+
currentShortOption = { ...token };
|
|
417
|
+
} else expandableShortOptions.push({ ...token });
|
|
418
|
+
} else {
|
|
419
|
+
currentShortOption.value = toShortValue();
|
|
420
|
+
optionTokens.push({ ...currentShortOption });
|
|
421
|
+
currentShortOption = { ...token };
|
|
422
|
+
}
|
|
423
|
+
applyLongOptionValue();
|
|
424
|
+
} else {
|
|
425
|
+
currentShortOption = { ...token };
|
|
426
|
+
applyLongOptionValue();
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
} else {
|
|
430
|
+
if (currentShortOption && currentShortOption.index == token.index && token.inlineValue) {
|
|
409
431
|
currentShortOption.value = token.value;
|
|
410
432
|
optionTokens.push({ ...currentShortOption });
|
|
411
|
-
currentShortOption =
|
|
412
|
-
} else expandableShortOptions.push({ ...token });
|
|
413
|
-
else {
|
|
414
|
-
currentShortOption.value = toShortValue();
|
|
415
|
-
optionTokens.push({ ...currentShortOption });
|
|
416
|
-
currentShortOption = { ...token };
|
|
433
|
+
currentShortOption = void 0;
|
|
417
434
|
}
|
|
418
435
|
applyLongOptionValue();
|
|
419
|
-
} else {
|
|
420
|
-
currentShortOption = { ...token };
|
|
421
|
-
applyLongOptionValue();
|
|
422
436
|
}
|
|
423
437
|
} else {
|
|
424
|
-
if (currentShortOption && currentShortOption.index == token.index && token.inlineValue) {
|
|
425
|
-
currentShortOption.value = token.value;
|
|
426
|
-
optionTokens.push({ ...currentShortOption });
|
|
427
|
-
currentShortOption = void 0;
|
|
428
|
-
}
|
|
429
|
-
applyLongOptionValue();
|
|
430
|
-
}
|
|
431
|
-
else {
|
|
432
438
|
if (token.kind === "option-terminator") terminated = true;
|
|
433
439
|
applyLongOptionValue();
|
|
434
440
|
applyShortOptionValue();
|
|
@@ -720,7 +726,7 @@ function checkConflicts(args, explicit, toKebab, actualInputNames) {
|
|
|
720
726
|
return [];
|
|
721
727
|
}
|
|
722
728
|
//#endregion
|
|
723
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
729
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/index.js
|
|
724
730
|
/**
|
|
725
731
|
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
726
732
|
* @license MIT
|
|
@@ -1366,27 +1372,28 @@ function getPositionalTokens(tokens) {
|
|
|
1366
1372
|
function resolveCommandTree(tokens, entry, options) {
|
|
1367
1373
|
const positionals = getPositionalTokens(tokens);
|
|
1368
1374
|
function resolveAsEntry() {
|
|
1369
|
-
if (typeof entry === "function")
|
|
1370
|
-
commandName
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1375
|
+
if (typeof entry === "function") {
|
|
1376
|
+
if ("commandName" in entry && entry.commandName) return {
|
|
1377
|
+
commandName: entry.commandName,
|
|
1378
|
+
command: entry,
|
|
1379
|
+
callMode: "entry",
|
|
1380
|
+
commandPath: [],
|
|
1381
|
+
depth: 0,
|
|
1382
|
+
omitted: options.subCommands.size > 0 && !positionals[0],
|
|
1383
|
+
levelSubCommands: options.subCommands.size > 0 ? options.subCommands : void 0
|
|
1384
|
+
};
|
|
1385
|
+
else return {
|
|
1386
|
+
command: {
|
|
1387
|
+
run: entry,
|
|
1388
|
+
entry: true
|
|
1389
|
+
},
|
|
1390
|
+
callMode: "entry",
|
|
1391
|
+
commandPath: [],
|
|
1392
|
+
depth: 0,
|
|
1393
|
+
omitted: options.subCommands.size > 0 && !positionals[0],
|
|
1394
|
+
levelSubCommands: options.subCommands.size > 0 ? options.subCommands : void 0
|
|
1395
|
+
};
|
|
1396
|
+
} else if (typeof entry === "object") return {
|
|
1390
1397
|
commandName: resolveEntryName(entry),
|
|
1391
1398
|
command: entry,
|
|
1392
1399
|
callMode: "entry",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gunshi/bone",
|
|
3
3
|
"description": "gunshi minimum",
|
|
4
|
-
"version": "0.37.
|
|
4
|
+
"version": "0.37.2",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
7
7
|
"email": "kawakazu80@gmail.com"
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"jsr-exports-lint": "^0.4.2",
|
|
57
57
|
"publint": "^0.3.20",
|
|
58
58
|
"tsdown": "0.21.0",
|
|
59
|
-
"@gunshi/plugin-global": "0.37.
|
|
60
|
-
"@gunshi/definition": "0.37.
|
|
61
|
-
"@gunshi/plugin-renderer": "0.37.
|
|
62
|
-
"gunshi": "0.37.
|
|
59
|
+
"@gunshi/plugin-global": "0.37.2",
|
|
60
|
+
"@gunshi/definition": "0.37.2",
|
|
61
|
+
"@gunshi/plugin-renderer": "0.37.2",
|
|
62
|
+
"gunshi": "0.37.2"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "tsdown",
|