@shell-shock/core 0.17.21 → 0.17.23
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/README.md +16 -7
- package/dist/api.cjs +4 -5
- package/dist/api.d.cts +1 -1
- package/dist/api.d.mts +1 -1
- package/dist/api.mjs +2 -2
- package/dist/command-B6KYexlV.d.mts +308 -0
- package/dist/command-B6KYexlV.d.mts.map +1 -0
- package/dist/command-CtfR7hKM.d.cts +308 -0
- package/dist/command-CtfR7hKM.d.cts.map +1 -0
- package/dist/components/command-validation-logic.cjs +153 -216
- package/dist/components/command-validation-logic.d.cts +2 -1
- package/dist/components/command-validation-logic.d.cts.map +1 -1
- package/dist/components/command-validation-logic.d.mts +2 -1
- package/dist/components/command-validation-logic.mjs +153 -214
- package/dist/components/docs.cjs +6 -364
- package/dist/components/docs.d.cts +2 -3
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +2 -3
- package/dist/components/docs.mjs +2 -356
- package/dist/components/exec-builtin.cjs +63 -100
- package/dist/components/exec-builtin.d.cts +1 -2
- package/dist/components/exec-builtin.d.cts.map +1 -1
- package/dist/components/exec-builtin.d.mts +1 -2
- package/dist/components/exec-builtin.mjs +7 -41
- package/dist/components/helpers.cjs +2 -52
- package/dist/components/helpers.d.cts +2 -1
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +2 -1
- package/dist/components/helpers.mjs +2 -50
- package/dist/components/index.cjs +7 -23
- package/dist/components/index.mjs +9 -9
- package/dist/components/options-parser-logic.cjs +198 -420
- package/dist/components/options-parser-logic.d.cts +2 -5
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +2 -5
- package/dist/components/options-parser-logic.mjs +192 -407
- package/dist/components/state-builtin.cjs +106 -164
- package/dist/components/state-builtin.d.cts +1 -2
- package/dist/components/state-builtin.d.cts.map +1 -1
- package/dist/components/state-builtin.d.mts +1 -2
- package/dist/components/state-builtin.mjs +12 -68
- package/dist/components/usage.cjs +4 -48
- package/dist/components/usage.d.cts +1 -2
- package/dist/components/usage.d.cts.map +1 -1
- package/dist/components/usage.d.mts +1 -2
- package/dist/components/usage.mjs +4 -46
- package/dist/components/utils-builtin.cjs +77 -144
- package/dist/components/utils-builtin.d.cts +1 -2
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +1 -2
- package/dist/components/utils-builtin.mjs +9 -74
- package/dist/config-BIF9mEz0.d.cts +157 -0
- package/dist/config-BIF9mEz0.d.cts.map +1 -0
- package/dist/config-CnNYdfsL.d.mts +157 -0
- package/dist/config-CnNYdfsL.d.mts.map +1 -0
- package/dist/config.cjs +24 -58
- package/dist/config.d.cts +1 -2
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +1 -2
- package/dist/config.mjs +23 -55
- package/dist/{plugin-utils/context-helpers.mjs → context-helpers-D3EJxwbq.mjs} +5 -83
- package/dist/context-helpers-D3EJxwbq.mjs.map +1 -0
- package/dist/{plugin-utils/context-helpers.cjs → context-helpers-_wUuFRB8.cjs} +63 -92
- package/dist/contexts/command.cjs +3 -9
- package/dist/contexts/command.d.cts +1 -2
- package/dist/contexts/command.d.cts.map +1 -1
- package/dist/contexts/command.d.mts +1 -2
- package/dist/contexts/command.mjs +2 -7
- package/dist/contexts/index.cjs +19 -1
- package/dist/contexts/index.d.cts +2 -1
- package/dist/contexts/index.d.mts +2 -1
- package/dist/contexts/index.mjs +2 -1
- package/dist/contexts/options.cjs +7 -30
- package/dist/contexts/options.d.cts +1 -2
- package/dist/contexts/options.d.cts.map +1 -1
- package/dist/contexts/options.d.mts +1 -2
- package/dist/contexts/options.mjs +7 -27
- package/dist/contexts/power-plant.cjs +19 -0
- package/dist/contexts/power-plant.d.cts +2 -0
- package/dist/contexts/power-plant.d.mts +2 -0
- package/dist/contexts/power-plant.mjs +5 -0
- package/dist/docs-C6ZvsVMu.cjs +278 -0
- package/dist/docs-CGQ2HtEY.mjs +249 -0
- package/dist/docs-CGQ2HtEY.mjs.map +1 -0
- package/dist/engine.cjs +5 -39
- package/dist/engine.d.cts +1 -2
- package/dist/engine.d.cts.map +1 -1
- package/dist/engine.d.mts +1 -2
- package/dist/engine.mjs +4 -37
- package/dist/generator.cjs +68 -0
- package/dist/generator.d.cts +15 -0
- package/dist/generator.d.cts.map +1 -0
- package/dist/generator.d.mts +15 -0
- package/dist/generator.d.mts.map +1 -0
- package/dist/generator.mjs +66 -0
- package/dist/generator.mjs.map +1 -0
- package/dist/{helpers/get-framework.cjs → get-framework-CxZc2krd.cjs} +7 -8
- package/dist/{helpers/get-framework.mjs → get-framework-Dlqz2hVZ.mjs} +3 -8
- package/dist/get-framework-Dlqz2hVZ.mjs.map +1 -0
- package/dist/helpers/power-plant.cjs +102 -0
- package/dist/helpers/power-plant.d.cts +61 -0
- package/dist/helpers/power-plant.d.cts.map +1 -0
- package/dist/helpers/power-plant.d.mts +61 -0
- package/dist/helpers/power-plant.d.mts.map +1 -0
- package/dist/helpers/power-plant.mjs +99 -0
- package/dist/helpers/power-plant.mjs.map +1 -0
- package/dist/index-D4klH_pj.d.mts +2 -0
- package/dist/index-DYOBadKY.d.cts +2 -0
- package/dist/index.cjs +1 -37
- package/dist/index.d.cts +4 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -6
- package/dist/index.mjs +0 -35
- package/dist/package-B7Vu265G.mjs +6 -0
- package/dist/package-B7Vu265G.mjs.map +1 -0
- package/dist/{package.cjs → package-BLC4qc8t.cjs} +2 -4
- package/dist/plugin-B-hM2twc.mjs +1458 -0
- package/dist/plugin-B-hM2twc.mjs.map +1 -0
- package/dist/plugin-Bhfq0DMC.cjs +1490 -0
- package/dist/plugin-utils/index.cjs +359 -26
- package/dist/plugin-utils/index.d.cts +273 -9
- package/dist/plugin-utils/index.d.cts.map +1 -0
- package/dist/plugin-utils/index.d.mts +273 -9
- package/dist/plugin-utils/index.d.mts.map +1 -0
- package/dist/plugin-utils/index.mjs +346 -10
- package/dist/plugin-utils/index.mjs.map +1 -0
- package/dist/plugin.cjs +3 -496
- package/dist/plugin.d.cts +1 -3
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +1 -3
- package/dist/plugin.mjs +2 -491
- package/dist/power-plant-LgxcvlMN.d.cts +4 -0
- package/dist/power-plant-LgxcvlMN.d.mts +4 -0
- package/dist/reflect-CSiffeL9.cjs +27 -0
- package/dist/reflect-DXKSFgvS.mjs +23 -0
- package/dist/reflect-DXKSFgvS.mjs.map +1 -0
- package/dist/schemas/env.cjs +91 -0
- package/dist/schemas/env.d.cts +145 -0
- package/dist/schemas/env.d.cts.map +1 -0
- package/dist/schemas/env.d.mts +145 -0
- package/dist/{types → schemas}/env.d.mts.map +1 -1
- package/dist/schemas/env.mjs +91 -0
- package/dist/schemas/index.cjs +4 -0
- package/dist/schemas/index.d.cts +2 -0
- package/dist/schemas/index.d.mts +2 -0
- package/dist/schemas/index.mjs +3 -0
- package/dist/types/command.cjs +0 -402
- package/dist/types/command.d.cts +2 -309
- package/dist/types/command.d.mts +2 -309
- package/dist/types/command.mjs +1 -368
- package/dist/types/config.cjs +0 -175
- package/dist/types/config.d.cts +2 -126
- package/dist/types/config.d.mts +2 -126
- package/dist/types/config.mjs +1 -164
- package/dist/types/context.cjs +0 -45
- package/dist/types/context.d.cts +2 -31
- package/dist/types/context.d.mts +2 -31
- package/dist/types/context.mjs +1 -41
- package/dist/types/index.cjs +3 -53
- package/dist/types/index.d.cts +4 -5
- package/dist/types/index.d.mts +4 -5
- package/dist/types/index.mjs +4 -5
- package/package.json +106 -42
- package/dist/_virtual/_rolldown/runtime.cjs +0 -29
- package/dist/api.cjs.map +0 -1
- package/dist/components/command-validation-logic.cjs.map +0 -1
- package/dist/components/docs.cjs.map +0 -1
- package/dist/components/docs.mjs.map +0 -1
- package/dist/components/exec-builtin.cjs.map +0 -1
- package/dist/components/helpers.cjs.map +0 -1
- package/dist/components/options-parser-logic.cjs.map +0 -1
- package/dist/components/state-builtin.cjs.map +0 -1
- package/dist/components/usage.cjs.map +0 -1
- package/dist/components/utils-builtin.cjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/contexts/command.cjs.map +0 -1
- package/dist/contexts/options.cjs.map +0 -1
- package/dist/engine.cjs.map +0 -1
- package/dist/helpers/automd.cjs +0 -193
- package/dist/helpers/automd.cjs.map +0 -1
- package/dist/helpers/automd.mjs +0 -190
- package/dist/helpers/automd.mjs.map +0 -1
- package/dist/helpers/docs-helpers.cjs +0 -24
- package/dist/helpers/docs-helpers.cjs.map +0 -1
- package/dist/helpers/docs-helpers.mjs +0 -24
- package/dist/helpers/docs-helpers.mjs.map +0 -1
- package/dist/helpers/get-framework.cjs.map +0 -1
- package/dist/helpers/get-framework.mjs.map +0 -1
- package/dist/helpers/paths.cjs +0 -137
- package/dist/helpers/paths.cjs.map +0 -1
- package/dist/helpers/paths.mjs +0 -134
- package/dist/helpers/paths.mjs.map +0 -1
- package/dist/helpers/persistence.cjs +0 -114
- package/dist/helpers/persistence.cjs.map +0 -1
- package/dist/helpers/persistence.mjs +0 -113
- package/dist/helpers/persistence.mjs.map +0 -1
- package/dist/helpers/update-package-json.cjs +0 -65
- package/dist/helpers/update-package-json.cjs.map +0 -1
- package/dist/helpers/update-package-json.mjs +0 -64
- package/dist/helpers/update-package-json.mjs.map +0 -1
- package/dist/helpers/utilities.cjs +0 -95
- package/dist/helpers/utilities.cjs.map +0 -1
- package/dist/helpers/utilities.mjs +0 -94
- package/dist/helpers/utilities.mjs.map +0 -1
- package/dist/helpers/validations.cjs +0 -71
- package/dist/helpers/validations.cjs.map +0 -1
- package/dist/helpers/validations.mjs +0 -70
- package/dist/helpers/validations.mjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/package.cjs.map +0 -1
- package/dist/package.mjs +0 -6
- package/dist/package.mjs.map +0 -1
- package/dist/plugin-utils/compute-bin.cjs +0 -49
- package/dist/plugin-utils/compute-bin.cjs.map +0 -1
- package/dist/plugin-utils/compute-bin.d.cts +0 -13
- package/dist/plugin-utils/compute-bin.d.cts.map +0 -1
- package/dist/plugin-utils/compute-bin.d.mts +0 -13
- package/dist/plugin-utils/compute-bin.d.mts.map +0 -1
- package/dist/plugin-utils/compute-bin.mjs +0 -49
- package/dist/plugin-utils/compute-bin.mjs.map +0 -1
- package/dist/plugin-utils/context-helpers.cjs.map +0 -1
- package/dist/plugin-utils/context-helpers.d.cts +0 -106
- package/dist/plugin-utils/context-helpers.d.cts.map +0 -1
- package/dist/plugin-utils/context-helpers.d.mts +0 -106
- package/dist/plugin-utils/context-helpers.d.mts.map +0 -1
- package/dist/plugin-utils/context-helpers.mjs.map +0 -1
- package/dist/plugin-utils/deepkit.cjs +0 -70
- package/dist/plugin-utils/deepkit.cjs.map +0 -1
- package/dist/plugin-utils/deepkit.d.cts +0 -23
- package/dist/plugin-utils/deepkit.d.cts.map +0 -1
- package/dist/plugin-utils/deepkit.d.mts +0 -23
- package/dist/plugin-utils/deepkit.d.mts.map +0 -1
- package/dist/plugin-utils/deepkit.mjs +0 -69
- package/dist/plugin-utils/deepkit.mjs.map +0 -1
- package/dist/plugin-utils/description-helpers.cjs +0 -112
- package/dist/plugin-utils/description-helpers.cjs.map +0 -1
- package/dist/plugin-utils/description-helpers.d.cts +0 -44
- package/dist/plugin-utils/description-helpers.d.cts.map +0 -1
- package/dist/plugin-utils/description-helpers.d.mts +0 -44
- package/dist/plugin-utils/description-helpers.d.mts.map +0 -1
- package/dist/plugin-utils/description-helpers.mjs +0 -108
- package/dist/plugin-utils/description-helpers.mjs.map +0 -1
- package/dist/plugin-utils/get-command-tree.cjs +0 -118
- package/dist/plugin-utils/get-command-tree.cjs.map +0 -1
- package/dist/plugin-utils/get-command-tree.d.cts +0 -36
- package/dist/plugin-utils/get-command-tree.d.cts.map +0 -1
- package/dist/plugin-utils/get-command-tree.d.mts +0 -36
- package/dist/plugin-utils/get-command-tree.d.mts.map +0 -1
- package/dist/plugin-utils/get-command-tree.mjs +0 -115
- package/dist/plugin-utils/get-command-tree.mjs.map +0 -1
- package/dist/plugin-utils/reflect.cjs +0 -54
- package/dist/plugin-utils/reflect.cjs.map +0 -1
- package/dist/plugin-utils/reflect.d.cts +0 -14
- package/dist/plugin-utils/reflect.d.cts.map +0 -1
- package/dist/plugin-utils/reflect.d.mts +0 -14
- package/dist/plugin-utils/reflect.d.mts.map +0 -1
- package/dist/plugin-utils/reflect.mjs +0 -53
- package/dist/plugin-utils/reflect.mjs.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.cjs +0 -65
- package/dist/plugin-utils/traverse-command-tree.cjs.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.d.cts +0 -22
- package/dist/plugin-utils/traverse-command-tree.d.cts.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.d.mts +0 -22
- package/dist/plugin-utils/traverse-command-tree.d.mts.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.mjs +0 -63
- package/dist/plugin-utils/traverse-command-tree.mjs.map +0 -1
- package/dist/plugin-utils/type-checks.cjs +0 -222
- package/dist/plugin-utils/type-checks.cjs.map +0 -1
- package/dist/plugin-utils/type-checks.d.cts +0 -41
- package/dist/plugin-utils/type-checks.d.cts.map +0 -1
- package/dist/plugin-utils/type-checks.d.mts +0 -41
- package/dist/plugin-utils/type-checks.d.mts.map +0 -1
- package/dist/plugin-utils/type-checks.mjs +0 -218
- package/dist/plugin-utils/type-checks.mjs.map +0 -1
- package/dist/plugin.cjs.map +0 -1
- package/dist/plugin.mjs.map +0 -1
- package/dist/resolver/deepkit.cjs +0 -110
- package/dist/resolver/deepkit.cjs.map +0 -1
- package/dist/resolver/deepkit.mjs +0 -109
- package/dist/resolver/deepkit.mjs.map +0 -1
- package/dist/resolver/helpers.cjs +0 -184
- package/dist/resolver/helpers.cjs.map +0 -1
- package/dist/resolver/helpers.mjs +0 -180
- package/dist/resolver/helpers.mjs.map +0 -1
- package/dist/resolver/resolve.cjs +0 -473
- package/dist/resolver/resolve.cjs.map +0 -1
- package/dist/resolver/resolve.mjs +0 -473
- package/dist/resolver/resolve.mjs.map +0 -1
- package/dist/types/command.cjs.map +0 -1
- package/dist/types/command.d.cts.map +0 -1
- package/dist/types/command.d.mts.map +0 -1
- package/dist/types/command.mjs.map +0 -1
- package/dist/types/config.cjs.map +0 -1
- package/dist/types/config.d.cts.map +0 -1
- package/dist/types/config.d.mts.map +0 -1
- package/dist/types/config.mjs.map +0 -1
- package/dist/types/context.cjs.map +0 -1
- package/dist/types/context.d.cts.map +0 -1
- package/dist/types/context.d.mts.map +0 -1
- package/dist/types/context.mjs.map +0 -1
- package/dist/types/env.cjs +0 -53
- package/dist/types/env.cjs.map +0 -1
- package/dist/types/env.d.cts +0 -71
- package/dist/types/env.d.cts.map +0 -1
- package/dist/types/env.d.mts +0 -71
- package/dist/types/env.mjs +0 -51
- /package/dist/{types → schemas}/env.mjs.map +0 -0
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { mergeCommandParameter } from "./helpers.mjs";
|
|
2
|
-
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
3
|
-
import { ReflectionKind, stringifyType } from "@powerlines/deepkit/vendor/type";
|
|
4
|
-
import { isBigInt } from "@stryke/type-checks/is-bigint";
|
|
5
|
-
import { isNumber } from "@stryke/type-checks/is-number";
|
|
6
|
-
import { isRegExp } from "@stryke/type-checks/is-regexp";
|
|
7
|
-
|
|
8
|
-
//#region src/resolver/deepkit.ts
|
|
9
|
-
function __assignType(fn, args) {
|
|
10
|
-
fn.__type = args;
|
|
11
|
-
return fn;
|
|
12
|
-
}
|
|
13
|
-
function resolveCommandParameterType(type) {
|
|
14
|
-
const isKind = !(isSetObject(type) && "kind" in type);
|
|
15
|
-
const kind = !isKind ? type.kind : type;
|
|
16
|
-
if (kind === ReflectionKind.string) return "string";
|
|
17
|
-
else if (kind === ReflectionKind.number || kind === ReflectionKind.bigint || !isKind && type.kind === ReflectionKind.literal && (isNumber(type.literal) || isBigInt(type.literal))) return "number";
|
|
18
|
-
else if (kind === ReflectionKind.boolean) return "boolean";
|
|
19
|
-
else return "string";
|
|
20
|
-
}
|
|
21
|
-
resolveCommandParameterType.__type = [
|
|
22
|
-
"type",
|
|
23
|
-
"string",
|
|
24
|
-
"number",
|
|
25
|
-
"boolean",
|
|
26
|
-
"resolveCommandParameterType",
|
|
27
|
-
"PP!!J2!P.\".#.$J/%"
|
|
28
|
-
];
|
|
29
|
-
function resolveCommandOption(ctx, reflection) {
|
|
30
|
-
const type = reflection.getType();
|
|
31
|
-
const existing = ctx.output.options[reflection.getNameAsString()] ?? {};
|
|
32
|
-
const option = {
|
|
33
|
-
name: reflection.getNameAsString(),
|
|
34
|
-
alias: reflection.getTags().alias ?? [],
|
|
35
|
-
title: reflection.getTags().title?.trim(),
|
|
36
|
-
description: reflection.getDescription(),
|
|
37
|
-
type: resolveCommandParameterType(type),
|
|
38
|
-
required: !reflection.isOptional(),
|
|
39
|
-
default: reflection.getDefaultValue(),
|
|
40
|
-
variadic: reflection.isArray()
|
|
41
|
-
};
|
|
42
|
-
if (option.variadic) option.type = resolveCommandParameterType(type.type.kind);
|
|
43
|
-
else if (type.kind === ReflectionKind.union) {
|
|
44
|
-
option.type = type.types.every(__assignType((t) => t.kind === ReflectionKind.number || t.kind === ReflectionKind.literal && (isNumber(t.literal) || isBigInt(t.literal)), [
|
|
45
|
-
"t",
|
|
46
|
-
"",
|
|
47
|
-
"P\"2!\"/\""
|
|
48
|
-
])) ? "number" : "string";
|
|
49
|
-
option.choices = type.types.map(__assignType((t) => t.kind === ReflectionKind.literal ? isNumber(t.literal) ? t.literal : isBigInt(t.literal) ? Number(t.literal) : isRegExp(t.literal) ? t.literal.source : String(t.literal) : null, [
|
|
50
|
-
"t",
|
|
51
|
-
"",
|
|
52
|
-
"P\"2!\"/\""
|
|
53
|
-
])).filter(Boolean);
|
|
54
|
-
} else if (type.kind === ReflectionKind.literal) option.choices = [isNumber(type.literal) ? type.literal : isBigInt(type.literal) ? Number(type.literal) : isRegExp(type.literal) ? type.literal.source : String(type.literal)].filter(Boolean);
|
|
55
|
-
else if (!existing.type && type.kind !== ReflectionKind.boolean && type.kind !== ReflectionKind.string && type.kind !== ReflectionKind.number) throw new Error(`Unsupported type for option "${reflection.getNameAsString()}" in command "${ctx.input.command.name}". Only string, number, boolean, string[], number[], or literal[] are supported, received ${stringifyType(type).trim().replaceAll(" | ", ", or ")}.`);
|
|
56
|
-
return mergeCommandParameter(existing, option);
|
|
57
|
-
}
|
|
58
|
-
resolveCommandOption.__type = [
|
|
59
|
-
"ResolverContext",
|
|
60
|
-
"ctx",
|
|
61
|
-
"reflection",
|
|
62
|
-
"CommandOption",
|
|
63
|
-
"resolveCommandOption",
|
|
64
|
-
"P\"w!2\"!2#\"w$/%"
|
|
65
|
-
];
|
|
66
|
-
function resolveCommandArgument(ctx, index, reflection) {
|
|
67
|
-
const type = reflection.getType();
|
|
68
|
-
const existing = ctx.output.args.length > index ? ctx.output.args[index] : {};
|
|
69
|
-
const argument = {
|
|
70
|
-
name: reflection.getName() || reflection.parameter.name,
|
|
71
|
-
alias: reflection.getAlias(),
|
|
72
|
-
type: resolveCommandParameterType(type.kind),
|
|
73
|
-
title: reflection.getTitle() || reflection.parameter.tags?.title,
|
|
74
|
-
description: reflection.parameter.description,
|
|
75
|
-
required: !reflection.isOptional(),
|
|
76
|
-
default: reflection.getDefaultValue()
|
|
77
|
-
};
|
|
78
|
-
if (type.kind === ReflectionKind.array) if (type.type.kind === ReflectionKind.string || type.type.kind === ReflectionKind.number) {
|
|
79
|
-
argument.variadic = true;
|
|
80
|
-
argument.type = resolveCommandParameterType(type.type.kind);
|
|
81
|
-
} else throw new Error(`Unsupported array type for positional argument "${argument.name}" in command "${ctx.input.command.name}". Only string[], number[], or literal[] are supported, received ${stringifyType(type).trim().replaceAll(" | ", ", or ")}.`);
|
|
82
|
-
else if (type.kind === ReflectionKind.union) {
|
|
83
|
-
argument.type = type.types.every(__assignType((t) => t.kind === ReflectionKind.number || t.kind === ReflectionKind.literal && (isNumber(t.literal) || isBigInt(t.literal)), [
|
|
84
|
-
"t",
|
|
85
|
-
"",
|
|
86
|
-
"P\"2!\"/\""
|
|
87
|
-
])) ? "number" : "string";
|
|
88
|
-
argument.choices = type.types.map(__assignType((t) => t.kind === ReflectionKind.literal ? isNumber(t.literal) ? t.literal : isBigInt(t.literal) ? Number(t.literal) : isRegExp(t.literal) ? t.literal.source : String(t.literal) : null, [
|
|
89
|
-
"t",
|
|
90
|
-
"",
|
|
91
|
-
"P\"2!\"/\""
|
|
92
|
-
])).filter(Boolean);
|
|
93
|
-
} else if (type.kind === ReflectionKind.literal) argument.choices = [isNumber(type.literal) ? type.literal : isBigInt(type.literal) ? Number(type.literal) : isRegExp(type.literal) ? type.literal.source : String(type.literal)].filter(Boolean);
|
|
94
|
-
else if (!ctx.output.args?.length && type.kind !== ReflectionKind.boolean && type.kind !== ReflectionKind.string && type.kind !== ReflectionKind.number) throw new Error(`Unsupported type for positional argument "${argument.name}" in command "${ctx.input.command.name}". Only string, number, boolean, string[], number[], or literal[] are supported, received ${stringifyType(type).trim().replaceAll(" | ", ", or ")}.`);
|
|
95
|
-
return mergeCommandParameter(existing, argument, { name: `arg${index}` });
|
|
96
|
-
}
|
|
97
|
-
resolveCommandArgument.__type = [
|
|
98
|
-
"ResolverContext",
|
|
99
|
-
"ctx",
|
|
100
|
-
"index",
|
|
101
|
-
"reflection",
|
|
102
|
-
"CommandArgument",
|
|
103
|
-
"resolveCommandArgument",
|
|
104
|
-
"P\"w!2\"'2#!2$\"w%/&"
|
|
105
|
-
];
|
|
106
|
-
|
|
107
|
-
//#endregion
|
|
108
|
-
export { resolveCommandArgument, resolveCommandOption };
|
|
109
|
-
//# sourceMappingURL=deepkit.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deepkit.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
|
|
2
|
-
let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
3
|
-
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
4
|
-
let defu = require("defu");
|
|
5
|
-
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
6
|
-
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
7
|
-
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
8
|
-
|
|
9
|
-
//#region src/resolver/helpers.ts
|
|
10
|
-
function __assignType(fn, args) {
|
|
11
|
-
fn.__type = args;
|
|
12
|
-
return fn;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Resolves the description for a command option based on its reflection.
|
|
16
|
-
*
|
|
17
|
-
* @param name - The name of the command option.
|
|
18
|
-
* @param type - The reflection kind of the command option.
|
|
19
|
-
* @param required - Whether the command option is required.
|
|
20
|
-
* @param variadic - Whether the command option is variadic (i.e., an array).
|
|
21
|
-
* @param title - The title of the command option, if any.
|
|
22
|
-
* @param defaultValue - The default value of the command option, if any.
|
|
23
|
-
* @returns The resolved description for the command option.
|
|
24
|
-
*/
|
|
25
|
-
function resolveCommandOptionDescription(name, type, required = true, variadic = false, title, defaultValue) {
|
|
26
|
-
return `A${!required && !defaultValue ? "n optional" : ""} command-line ${type === "boolean" ? "flag" : "option"} that allows the user to ${type === "boolean" ? "set the" : variadic ? "specify custom" : "specify a custom"} ${title?.trim() || (0, _stryke_string_format_title_case.titleCase)(name)} ${type === "boolean" ? "indicator" : `${type === "number" ? "numeric" : "string"} value${variadic ? "s" : ""}`}.`;
|
|
27
|
-
}
|
|
28
|
-
resolveCommandOptionDescription.__type = [
|
|
29
|
-
"name",
|
|
30
|
-
"string",
|
|
31
|
-
"number",
|
|
32
|
-
"boolean",
|
|
33
|
-
"type",
|
|
34
|
-
"required",
|
|
35
|
-
"variadic",
|
|
36
|
-
"title",
|
|
37
|
-
"defaultValue",
|
|
38
|
-
"resolveCommandOptionDescription",
|
|
39
|
-
"Resolves the description for a command option based on its reflection.",
|
|
40
|
-
"P&2!P.\".#.$J2%\"2&\"2'&2(8\"2)8&/*?+"
|
|
41
|
-
];
|
|
42
|
-
/**
|
|
43
|
-
* Resolves the description for a command argument based on its reflection.
|
|
44
|
-
*
|
|
45
|
-
* @param name - The name of the command argument.
|
|
46
|
-
* @param type - The reflection kind of the command argument.
|
|
47
|
-
* @param required - Whether the command argument is required.
|
|
48
|
-
* @param variadic - Whether the command argument is variadic (i.e., an array).
|
|
49
|
-
* @param title - The title of the command argument, if any.
|
|
50
|
-
* @param defaultValue - The default value of the command argument, if any.
|
|
51
|
-
* @returns The resolved description for the command argument.
|
|
52
|
-
*/
|
|
53
|
-
function resolveCommandArgumentDescription(name, type, required = true, variadic = false, title, defaultValue) {
|
|
54
|
-
return `An${!required && !defaultValue ? " optional" : ""} argument that allows the user to ${type === "boolean" ? "set the" : variadic ? "specify custom" : "specify a custom"} ${title?.trim() || (0, _stryke_string_format_title_case.titleCase)(name)} ${type === "boolean" ? "indicator" : `${type === "number" ? "numeric" : "string"} value${variadic ? "s" : ""}`}.`;
|
|
55
|
-
}
|
|
56
|
-
resolveCommandArgumentDescription.__type = [
|
|
57
|
-
"name",
|
|
58
|
-
"string",
|
|
59
|
-
"number",
|
|
60
|
-
"boolean",
|
|
61
|
-
"type",
|
|
62
|
-
"required",
|
|
63
|
-
"variadic",
|
|
64
|
-
"title",
|
|
65
|
-
"defaultValue",
|
|
66
|
-
"resolveCommandArgumentDescription",
|
|
67
|
-
"Resolves the description for a command argument based on its reflection.",
|
|
68
|
-
"P&2!P.\".#.$J2%\"2&\"2'&2(8\"2)8&/*?+"
|
|
69
|
-
];
|
|
70
|
-
function applyOptionsDefaults(ctx) {
|
|
71
|
-
return Object.fromEntries(Object.entries(ctx.output.options).map(__assignType(([key, option]) => {
|
|
72
|
-
const name = option.name || key;
|
|
73
|
-
const title = option.title || (0, _stryke_string_format_title_case.titleCase)(name);
|
|
74
|
-
return [key, {
|
|
75
|
-
...option,
|
|
76
|
-
name,
|
|
77
|
-
title,
|
|
78
|
-
description: option.description || resolveCommandOptionDescription(name, option.type, option.required, option.type !== "boolean" && option.variadic, title, option.default),
|
|
79
|
-
env: option.env || option.env === false ? option.env : ctx.input.context.config.autoAssignEnv ? (0, _stryke_string_format_constant_case.constantCase)(name) : false
|
|
80
|
-
}];
|
|
81
|
-
}, [
|
|
82
|
-
"param0",
|
|
83
|
-
"",
|
|
84
|
-
"P\"2!\"/\""
|
|
85
|
-
])));
|
|
86
|
-
}
|
|
87
|
-
applyOptionsDefaults.__type = [
|
|
88
|
-
"ResolverContext",
|
|
89
|
-
"ctx",
|
|
90
|
-
"applyOptionsDefaults",
|
|
91
|
-
"P\"w!2\"\"/#"
|
|
92
|
-
];
|
|
93
|
-
function applyArgsDefaults(ctx) {
|
|
94
|
-
return ctx.output.args.map(__assignType((arg, i) => {
|
|
95
|
-
const name = arg.name || `arg${i + 1}`;
|
|
96
|
-
const title = arg.title || (0, _stryke_string_format_title_case.titleCase)(name);
|
|
97
|
-
return {
|
|
98
|
-
...arg,
|
|
99
|
-
name,
|
|
100
|
-
title,
|
|
101
|
-
description: arg.description || resolveCommandArgumentDescription(name, arg.type, arg.required, arg.type !== "boolean" && arg.variadic, title, arg.default),
|
|
102
|
-
env: arg.name ? arg.env || arg.env === false ? arg.env : ctx.input.context.config.autoAssignEnv ? (0, _stryke_string_format_constant_case.constantCase)(name) : false : false
|
|
103
|
-
};
|
|
104
|
-
}, [
|
|
105
|
-
"arg",
|
|
106
|
-
"i",
|
|
107
|
-
"",
|
|
108
|
-
"P\"2!\"2\"\"/#"
|
|
109
|
-
]));
|
|
110
|
-
}
|
|
111
|
-
applyArgsDefaults.__type = [
|
|
112
|
-
"ResolverContext",
|
|
113
|
-
"ctx",
|
|
114
|
-
"CommandArgument",
|
|
115
|
-
"applyArgsDefaults",
|
|
116
|
-
"P\"w!2\"\"w#F/$"
|
|
117
|
-
];
|
|
118
|
-
function applyDefaults(ctx) {
|
|
119
|
-
ctx.output.description ??= `The ${ctx.output.title.replace(/(?:c|C)ommands?$/, "").trim()} executable command-line interface.`;
|
|
120
|
-
if (ctx.input.command.segments.length && (0, _stryke_type_checks_is_set_string.isSetString)(ctx.input.context.config.docs?.commands) && /\{(?:(?:C|c)ommands?|(?:C|c)mds?)\}/.test(ctx.input.context.config.docs.commands)) ctx.output.docs ??= ctx.input.context.config.docs.commands ? ctx.input.context.config.docs.commands.replace(/\{(?:(?:C|c)ommands?|(?:C|c)mds?)\}/, ctx.input.command.segments.filter(__assignType((segment) => !require_context_helpers.isDynamicPathSegment(segment), [
|
|
121
|
-
"segment",
|
|
122
|
-
"",
|
|
123
|
-
"P\"2!\"/\""
|
|
124
|
-
])).join("/")) : void 0;
|
|
125
|
-
else if (!ctx.input.command.segments.length && (0, _stryke_type_checks_is_set_string.isSetString)(ctx.input.context.config.docs?.app)) ctx.output.docs ??= ctx.input.context.config.docs.app;
|
|
126
|
-
}
|
|
127
|
-
applyDefaults.__type = [
|
|
128
|
-
"ResolverContext",
|
|
129
|
-
"ctx",
|
|
130
|
-
"applyDefaults",
|
|
131
|
-
"P\"w!2\"\"/#"
|
|
132
|
-
];
|
|
133
|
-
/**
|
|
134
|
-
* Resolves a virtual command by applying default values to its title and description based on the command name and application title.
|
|
135
|
-
*
|
|
136
|
-
* @template TContext - The type of the context object.
|
|
137
|
-
* @param ctx - The resolver context containing the input and output for the command resolution process.
|
|
138
|
-
*/
|
|
139
|
-
function resolveVirtualCommand(ctx) {
|
|
140
|
-
ctx.output.title ??= (0, _stryke_string_format_title_case.titleCase)(ctx.input.command.name);
|
|
141
|
-
ctx.output.description ??= `A collection of available ${ctx.output.title.replace(/(?:c|C)ommands?$/, "").trim() || (0, _stryke_string_format_title_case.titleCase)(ctx.input.command.name)} commands that are included in the ${require_context_helpers.getAppTitle(ctx.input.context, true)} command-line application.`;
|
|
142
|
-
}
|
|
143
|
-
resolveVirtualCommand.__type = [
|
|
144
|
-
"ResolverContext",
|
|
145
|
-
"ctx",
|
|
146
|
-
"resolveVirtualCommand",
|
|
147
|
-
"Resolves a virtual command by applying default values to its title and description based on the command name and application title.",
|
|
148
|
-
"P\"w!2\"\"/#?$"
|
|
149
|
-
];
|
|
150
|
-
/**
|
|
151
|
-
* Merges two command parameters, giving precedence to string values in the second configuration.
|
|
152
|
-
*
|
|
153
|
-
* @param objA - The first command parameter object.
|
|
154
|
-
* @param objB - The second command parameter object.
|
|
155
|
-
* @returns The merged command parameter object.
|
|
156
|
-
*/
|
|
157
|
-
const mergeCommandParameter = (0, defu.createDefu)(__assignType((obj, key, value) => {
|
|
158
|
-
if ((0, _stryke_type_checks_is_string.isString)(obj[key]) && (0, _stryke_type_checks_is_string.isString)(value)) {
|
|
159
|
-
if ((0, _stryke_type_checks_is_set_string.isSetString)(value)) obj[key] = value;
|
|
160
|
-
return true;
|
|
161
|
-
} else if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
162
|
-
if (value.length > 0) obj[key] = (0, _stryke_helpers_get_unique.getUniqueBy)(obj[key].concat(value), __assignType((item) => (0, _stryke_type_checks_is_string.isString)(item) ? item : JSON.stringify(item), [
|
|
163
|
-
"item",
|
|
164
|
-
"",
|
|
165
|
-
"P\"2!\"/\""
|
|
166
|
-
]));
|
|
167
|
-
return true;
|
|
168
|
-
}
|
|
169
|
-
return false;
|
|
170
|
-
}, [
|
|
171
|
-
"obj",
|
|
172
|
-
"key",
|
|
173
|
-
"value",
|
|
174
|
-
"",
|
|
175
|
-
"P\"2!\"2\"\"2#\"/$"
|
|
176
|
-
]));
|
|
177
|
-
|
|
178
|
-
//#endregion
|
|
179
|
-
exports.applyArgsDefaults = applyArgsDefaults;
|
|
180
|
-
exports.applyDefaults = applyDefaults;
|
|
181
|
-
exports.applyOptionsDefaults = applyOptionsDefaults;
|
|
182
|
-
exports.mergeCommandParameter = mergeCommandParameter;
|
|
183
|
-
exports.resolveVirtualCommand = resolveVirtualCommand;
|
|
184
|
-
//# sourceMappingURL=helpers.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.cjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { getAppTitle, isDynamicPathSegment } from "../plugin-utils/context-helpers.mjs";
|
|
2
|
-
import { constantCase } from "@stryke/string-format/constant-case";
|
|
3
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
4
|
-
import { createDefu } from "defu";
|
|
5
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
6
|
-
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
7
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
8
|
-
|
|
9
|
-
//#region src/resolver/helpers.ts
|
|
10
|
-
function __assignType(fn, args) {
|
|
11
|
-
fn.__type = args;
|
|
12
|
-
return fn;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Resolves the description for a command option based on its reflection.
|
|
16
|
-
*
|
|
17
|
-
* @param name - The name of the command option.
|
|
18
|
-
* @param type - The reflection kind of the command option.
|
|
19
|
-
* @param required - Whether the command option is required.
|
|
20
|
-
* @param variadic - Whether the command option is variadic (i.e., an array).
|
|
21
|
-
* @param title - The title of the command option, if any.
|
|
22
|
-
* @param defaultValue - The default value of the command option, if any.
|
|
23
|
-
* @returns The resolved description for the command option.
|
|
24
|
-
*/
|
|
25
|
-
function resolveCommandOptionDescription(name, type, required = true, variadic = false, title, defaultValue) {
|
|
26
|
-
return `A${!required && !defaultValue ? "n optional" : ""} command-line ${type === "boolean" ? "flag" : "option"} that allows the user to ${type === "boolean" ? "set the" : variadic ? "specify custom" : "specify a custom"} ${title?.trim() || titleCase(name)} ${type === "boolean" ? "indicator" : `${type === "number" ? "numeric" : "string"} value${variadic ? "s" : ""}`}.`;
|
|
27
|
-
}
|
|
28
|
-
resolveCommandOptionDescription.__type = [
|
|
29
|
-
"name",
|
|
30
|
-
"string",
|
|
31
|
-
"number",
|
|
32
|
-
"boolean",
|
|
33
|
-
"type",
|
|
34
|
-
"required",
|
|
35
|
-
"variadic",
|
|
36
|
-
"title",
|
|
37
|
-
"defaultValue",
|
|
38
|
-
"resolveCommandOptionDescription",
|
|
39
|
-
"Resolves the description for a command option based on its reflection.",
|
|
40
|
-
"P&2!P.\".#.$J2%\"2&\"2'&2(8\"2)8&/*?+"
|
|
41
|
-
];
|
|
42
|
-
/**
|
|
43
|
-
* Resolves the description for a command argument based on its reflection.
|
|
44
|
-
*
|
|
45
|
-
* @param name - The name of the command argument.
|
|
46
|
-
* @param type - The reflection kind of the command argument.
|
|
47
|
-
* @param required - Whether the command argument is required.
|
|
48
|
-
* @param variadic - Whether the command argument is variadic (i.e., an array).
|
|
49
|
-
* @param title - The title of the command argument, if any.
|
|
50
|
-
* @param defaultValue - The default value of the command argument, if any.
|
|
51
|
-
* @returns The resolved description for the command argument.
|
|
52
|
-
*/
|
|
53
|
-
function resolveCommandArgumentDescription(name, type, required = true, variadic = false, title, defaultValue) {
|
|
54
|
-
return `An${!required && !defaultValue ? " optional" : ""} argument that allows the user to ${type === "boolean" ? "set the" : variadic ? "specify custom" : "specify a custom"} ${title?.trim() || titleCase(name)} ${type === "boolean" ? "indicator" : `${type === "number" ? "numeric" : "string"} value${variadic ? "s" : ""}`}.`;
|
|
55
|
-
}
|
|
56
|
-
resolveCommandArgumentDescription.__type = [
|
|
57
|
-
"name",
|
|
58
|
-
"string",
|
|
59
|
-
"number",
|
|
60
|
-
"boolean",
|
|
61
|
-
"type",
|
|
62
|
-
"required",
|
|
63
|
-
"variadic",
|
|
64
|
-
"title",
|
|
65
|
-
"defaultValue",
|
|
66
|
-
"resolveCommandArgumentDescription",
|
|
67
|
-
"Resolves the description for a command argument based on its reflection.",
|
|
68
|
-
"P&2!P.\".#.$J2%\"2&\"2'&2(8\"2)8&/*?+"
|
|
69
|
-
];
|
|
70
|
-
function applyOptionsDefaults(ctx) {
|
|
71
|
-
return Object.fromEntries(Object.entries(ctx.output.options).map(__assignType(([key, option]) => {
|
|
72
|
-
const name = option.name || key;
|
|
73
|
-
const title = option.title || titleCase(name);
|
|
74
|
-
return [key, {
|
|
75
|
-
...option,
|
|
76
|
-
name,
|
|
77
|
-
title,
|
|
78
|
-
description: option.description || resolveCommandOptionDescription(name, option.type, option.required, option.type !== "boolean" && option.variadic, title, option.default),
|
|
79
|
-
env: option.env || option.env === false ? option.env : ctx.input.context.config.autoAssignEnv ? constantCase(name) : false
|
|
80
|
-
}];
|
|
81
|
-
}, [
|
|
82
|
-
"param0",
|
|
83
|
-
"",
|
|
84
|
-
"P\"2!\"/\""
|
|
85
|
-
])));
|
|
86
|
-
}
|
|
87
|
-
applyOptionsDefaults.__type = [
|
|
88
|
-
"ResolverContext",
|
|
89
|
-
"ctx",
|
|
90
|
-
"applyOptionsDefaults",
|
|
91
|
-
"P\"w!2\"\"/#"
|
|
92
|
-
];
|
|
93
|
-
function applyArgsDefaults(ctx) {
|
|
94
|
-
return ctx.output.args.map(__assignType((arg, i) => {
|
|
95
|
-
const name = arg.name || `arg${i + 1}`;
|
|
96
|
-
const title = arg.title || titleCase(name);
|
|
97
|
-
return {
|
|
98
|
-
...arg,
|
|
99
|
-
name,
|
|
100
|
-
title,
|
|
101
|
-
description: arg.description || resolveCommandArgumentDescription(name, arg.type, arg.required, arg.type !== "boolean" && arg.variadic, title, arg.default),
|
|
102
|
-
env: arg.name ? arg.env || arg.env === false ? arg.env : ctx.input.context.config.autoAssignEnv ? constantCase(name) : false : false
|
|
103
|
-
};
|
|
104
|
-
}, [
|
|
105
|
-
"arg",
|
|
106
|
-
"i",
|
|
107
|
-
"",
|
|
108
|
-
"P\"2!\"2\"\"/#"
|
|
109
|
-
]));
|
|
110
|
-
}
|
|
111
|
-
applyArgsDefaults.__type = [
|
|
112
|
-
"ResolverContext",
|
|
113
|
-
"ctx",
|
|
114
|
-
"CommandArgument",
|
|
115
|
-
"applyArgsDefaults",
|
|
116
|
-
"P\"w!2\"\"w#F/$"
|
|
117
|
-
];
|
|
118
|
-
function applyDefaults(ctx) {
|
|
119
|
-
ctx.output.description ??= `The ${ctx.output.title.replace(/(?:c|C)ommands?$/, "").trim()} executable command-line interface.`;
|
|
120
|
-
if (ctx.input.command.segments.length && isSetString(ctx.input.context.config.docs?.commands) && /\{(?:(?:C|c)ommands?|(?:C|c)mds?)\}/.test(ctx.input.context.config.docs.commands)) ctx.output.docs ??= ctx.input.context.config.docs.commands ? ctx.input.context.config.docs.commands.replace(/\{(?:(?:C|c)ommands?|(?:C|c)mds?)\}/, ctx.input.command.segments.filter(__assignType((segment) => !isDynamicPathSegment(segment), [
|
|
121
|
-
"segment",
|
|
122
|
-
"",
|
|
123
|
-
"P\"2!\"/\""
|
|
124
|
-
])).join("/")) : void 0;
|
|
125
|
-
else if (!ctx.input.command.segments.length && isSetString(ctx.input.context.config.docs?.app)) ctx.output.docs ??= ctx.input.context.config.docs.app;
|
|
126
|
-
}
|
|
127
|
-
applyDefaults.__type = [
|
|
128
|
-
"ResolverContext",
|
|
129
|
-
"ctx",
|
|
130
|
-
"applyDefaults",
|
|
131
|
-
"P\"w!2\"\"/#"
|
|
132
|
-
];
|
|
133
|
-
/**
|
|
134
|
-
* Resolves a virtual command by applying default values to its title and description based on the command name and application title.
|
|
135
|
-
*
|
|
136
|
-
* @template TContext - The type of the context object.
|
|
137
|
-
* @param ctx - The resolver context containing the input and output for the command resolution process.
|
|
138
|
-
*/
|
|
139
|
-
function resolveVirtualCommand(ctx) {
|
|
140
|
-
ctx.output.title ??= titleCase(ctx.input.command.name);
|
|
141
|
-
ctx.output.description ??= `A collection of available ${ctx.output.title.replace(/(?:c|C)ommands?$/, "").trim() || titleCase(ctx.input.command.name)} commands that are included in the ${getAppTitle(ctx.input.context, true)} command-line application.`;
|
|
142
|
-
}
|
|
143
|
-
resolveVirtualCommand.__type = [
|
|
144
|
-
"ResolverContext",
|
|
145
|
-
"ctx",
|
|
146
|
-
"resolveVirtualCommand",
|
|
147
|
-
"Resolves a virtual command by applying default values to its title and description based on the command name and application title.",
|
|
148
|
-
"P\"w!2\"\"/#?$"
|
|
149
|
-
];
|
|
150
|
-
/**
|
|
151
|
-
* Merges two command parameters, giving precedence to string values in the second configuration.
|
|
152
|
-
*
|
|
153
|
-
* @param objA - The first command parameter object.
|
|
154
|
-
* @param objB - The second command parameter object.
|
|
155
|
-
* @returns The merged command parameter object.
|
|
156
|
-
*/
|
|
157
|
-
const mergeCommandParameter = createDefu(__assignType((obj, key, value) => {
|
|
158
|
-
if (isString(obj[key]) && isString(value)) {
|
|
159
|
-
if (isSetString(value)) obj[key] = value;
|
|
160
|
-
return true;
|
|
161
|
-
} else if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
162
|
-
if (value.length > 0) obj[key] = getUniqueBy(obj[key].concat(value), __assignType((item) => isString(item) ? item : JSON.stringify(item), [
|
|
163
|
-
"item",
|
|
164
|
-
"",
|
|
165
|
-
"P\"2!\"/\""
|
|
166
|
-
]));
|
|
167
|
-
return true;
|
|
168
|
-
}
|
|
169
|
-
return false;
|
|
170
|
-
}, [
|
|
171
|
-
"obj",
|
|
172
|
-
"key",
|
|
173
|
-
"value",
|
|
174
|
-
"",
|
|
175
|
-
"P\"2!\"2\"\"2#\"/$"
|
|
176
|
-
]));
|
|
177
|
-
|
|
178
|
-
//#endregion
|
|
179
|
-
export { applyArgsDefaults, applyDefaults, applyOptionsDefaults, mergeCommandParameter, resolveVirtualCommand };
|
|
180
|
-
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","names":[],"sources":[],"mappings":""}
|