@shell-shock/preset-cli 0.9.20 → 0.9.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/dist/_virtual/_rolldown/runtime.cjs +29 -1
- package/dist/components/banner-builtin.cjs +92 -5
- package/dist/components/banner-builtin.d.cts +2 -3
- package/dist/components/banner-builtin.d.cts.map +1 -1
- package/dist/components/banner-builtin.d.mts +3 -4
- package/dist/components/banner-builtin.d.mts.map +1 -1
- package/dist/components/banner-builtin.mjs +90 -5
- package/dist/components/banner-builtin.mjs.map +1 -1
- package/dist/components/command-entry.cjs +358 -56
- package/dist/components/command-entry.d.cts +1 -2
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +1 -2
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +355 -56
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +59 -4
- package/dist/components/command-router.d.cts +2 -3
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/command-router.d.mts +3 -4
- package/dist/components/command-router.d.mts.map +1 -1
- package/dist/components/command-router.mjs +57 -4
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/index.cjs +15 -1
- package/dist/components/index.mjs +7 -1
- package/dist/components/upgrade-builtin.cjs +134 -14
- package/dist/components/upgrade-builtin.d.cts +2 -3
- package/dist/components/upgrade-builtin.d.cts.map +1 -1
- package/dist/components/upgrade-builtin.d.mts +2 -3
- package/dist/components/upgrade-builtin.d.mts.map +1 -1
- package/dist/components/upgrade-builtin.mjs +132 -14
- package/dist/components/upgrade-builtin.mjs.map +1 -1
- package/dist/components/virtual-command-entry.cjs +116 -1
- package/dist/components/virtual-command-entry.d.cts +1 -2
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts +1 -2
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +113 -1
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-global-options.cjs +37 -1
- package/dist/helpers/get-global-options.mjs +37 -1
- package/dist/helpers/get-global-options.mjs.map +1 -1
- package/dist/index.cjs +185 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +175 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.d.cts +11 -3
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +12 -4
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +24 -23
|
@@ -1,18 +1,169 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_components_virtual_command_entry = require('./virtual-command-entry.cjs');
|
|
4
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
6
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
7
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
8
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
9
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
10
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
11
|
+
let _powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
12
|
+
let _shell_shock_core_components_command_validation_logic = require("@shell-shock/core/components/command-validation-logic");
|
|
13
|
+
let _shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
|
|
14
|
+
let _stryke_path_find = require("@stryke/path/find");
|
|
15
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
16
|
+
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
17
|
+
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
18
|
+
let defu = require("defu");
|
|
19
|
+
defu = require_runtime.__toESM(defu);
|
|
20
|
+
|
|
21
|
+
//#region src/components/command-entry.tsx
|
|
22
|
+
/**
|
|
23
|
+
* The command entry point for the Shell Shock project.
|
|
24
|
+
*/
|
|
25
|
+
function CommandEntry(props) {
|
|
26
|
+
const { command, imports, builtinImports, ...rest } = props;
|
|
27
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
28
|
+
const filePath = (0, _alloy_js_core.computed)(() => (0, _stryke_path_join.joinPaths)(command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)).join("/"), "index.ts"));
|
|
29
|
+
const commandSourcePath = (0, _alloy_js_core.computed)(() => (0, _stryke_path_replace.replaceExtension)((0, _stryke_path_find.relativePath)((0, _stryke_path_join.joinPaths)(context.entryPath, (0, _stryke_path_find.findFilePath)(filePath.value)), command.entry.input?.file || command.entry.file)));
|
|
30
|
+
const typeDefinition = (0, _alloy_js_core.computed)(() => ({
|
|
31
|
+
...command.entry,
|
|
32
|
+
output: command.id
|
|
33
|
+
}));
|
|
34
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_entry_file.EntryFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
35
|
+
get path() {
|
|
36
|
+
return filePath.value;
|
|
37
|
+
},
|
|
38
|
+
get typeDefinition() {
|
|
39
|
+
return typeDefinition.value;
|
|
40
|
+
},
|
|
41
|
+
get imports() {
|
|
42
|
+
return (0, defu.default)(imports ?? {}, { [commandSourcePath.value.startsWith(".") ? commandSourcePath.value : `./${commandSourcePath.value}`]: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(command.name)}` });
|
|
43
|
+
},
|
|
44
|
+
get builtinImports() {
|
|
45
|
+
return (0, defu.default)(builtinImports ?? {}, {
|
|
46
|
+
env: [
|
|
47
|
+
"env",
|
|
48
|
+
"isDevelopment",
|
|
49
|
+
"isDebug",
|
|
50
|
+
"paths"
|
|
51
|
+
],
|
|
52
|
+
console: [
|
|
53
|
+
"debug",
|
|
54
|
+
"info",
|
|
55
|
+
"help",
|
|
56
|
+
"warn",
|
|
57
|
+
"error",
|
|
58
|
+
"table",
|
|
59
|
+
"italic",
|
|
60
|
+
"cursor",
|
|
61
|
+
"stripAnsi",
|
|
62
|
+
"writeLine",
|
|
63
|
+
"splitText",
|
|
64
|
+
"textColors",
|
|
65
|
+
"createSpinner"
|
|
66
|
+
],
|
|
67
|
+
utils: [
|
|
68
|
+
"sleep",
|
|
69
|
+
"isMinimal",
|
|
70
|
+
"isInteractive",
|
|
71
|
+
"isUnicodeSupported"
|
|
72
|
+
],
|
|
73
|
+
state: [
|
|
74
|
+
{
|
|
75
|
+
name: "GlobalOptions",
|
|
76
|
+
type: true
|
|
77
|
+
},
|
|
78
|
+
"useGlobal",
|
|
79
|
+
"useGlobalOptions",
|
|
80
|
+
"withCommand",
|
|
81
|
+
"useArgs",
|
|
82
|
+
"hasFlag",
|
|
83
|
+
"isHelp"
|
|
84
|
+
],
|
|
85
|
+
prompts: [
|
|
86
|
+
"text",
|
|
87
|
+
"numeric",
|
|
88
|
+
"toggle",
|
|
89
|
+
"select",
|
|
90
|
+
"confirm",
|
|
91
|
+
"waitForKeyPress",
|
|
92
|
+
"isCancel"
|
|
93
|
+
],
|
|
94
|
+
[(0, _stryke_path_join.joinPaths)("help", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showHelp"],
|
|
95
|
+
[(0, _stryke_path_join.joinPaths)("banner", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showBanner"],
|
|
96
|
+
upgrade: ["executeUpgrade"]
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
get children() {
|
|
100
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}), (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_preset_script_components_command_entry.CommandHandlerDeclaration, {
|
|
101
|
+
command,
|
|
102
|
+
banner: _alloy_js_core.code`await showBanner();
|
|
103
|
+
await executeUpgrade(); `,
|
|
104
|
+
get children() {
|
|
105
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
106
|
+
condition: _alloy_js_core.code`!isInteractive`,
|
|
107
|
+
get children() {
|
|
108
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_command_validation_logic.CommandValidationLogic, { command });
|
|
109
|
+
}
|
|
110
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
111
|
+
get when() {
|
|
112
|
+
return Object.values(command.options ?? {}).filter((option) => option.required).length > 0 || Object.values(command.args ?? {}).filter((arg) => arg.required).length > 0;
|
|
113
|
+
},
|
|
114
|
+
get children() {
|
|
115
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
116
|
+
get condition() {
|
|
117
|
+
return _alloy_js_core.code`!isHelp() && (${Object.values(command.options ?? {}).filter((option) => option.required).map((option) => (option.type === "string" || option.type === "number") && option.variadic ? `(!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} || options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0)` : `options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} === undefined`).join(" || ")}${Object.values(command.options ?? {}).filter((option) => option.required).length > 0 && Object.values(command.args ?? {}).filter((arg) => arg.required).length > 0 ? " || " : ""}${Object.values(command.args ?? {}).filter((arg) => arg.required).map((arg) => (arg.type === "string" || arg.type === "number") && arg.variadic ? `(!${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} || ${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}.length === 0)` : `${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} === undefined`).join(" || ")}) `;
|
|
118
|
+
},
|
|
119
|
+
get children() {
|
|
120
|
+
return [
|
|
121
|
+
_alloy_js_core.code`writeLine(""); `,
|
|
122
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
123
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
124
|
+
get each() {
|
|
125
|
+
return Object.values(command.options ?? {});
|
|
126
|
+
},
|
|
127
|
+
doubleHardline: true,
|
|
128
|
+
children: (option) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
129
|
+
get when() {
|
|
130
|
+
return option.required;
|
|
131
|
+
},
|
|
132
|
+
get children() {
|
|
133
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
134
|
+
get condition() {
|
|
135
|
+
return _alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}`;
|
|
136
|
+
},
|
|
137
|
+
get children() {
|
|
138
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
139
|
+
get when() {
|
|
140
|
+
return option.type === "boolean" || !option.choices || option.choices.length === 0;
|
|
141
|
+
},
|
|
142
|
+
get fallback() {
|
|
143
|
+
return _alloy_js_core.code`const value = await select({
|
|
144
|
+
message: \`Please select a value for the \${italic("${option.name}")} option\`, ${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
145
|
+
` : ""}options: [ ${option.choices?.map((choice) => `{ value: ${JSON.stringify(choice)}, label: "${choice}", ${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(option.description)}\`` : ""} }`).join(", ")} ]
|
|
5
146
|
});
|
|
6
147
|
if (isCancel(value)) {
|
|
7
148
|
return;
|
|
8
149
|
}
|
|
9
150
|
|
|
10
|
-
options${
|
|
11
|
-
|
|
151
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
152
|
+
`;
|
|
153
|
+
},
|
|
154
|
+
get children() {
|
|
155
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Switch, { get children() {
|
|
156
|
+
return [
|
|
157
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
158
|
+
get when() {
|
|
159
|
+
return option.type === "string";
|
|
160
|
+
},
|
|
161
|
+
get children() {
|
|
162
|
+
return _alloy_js_core.code`
|
|
12
163
|
const value = await text({
|
|
13
|
-
message: \`Please provide a value for the \${italic("${
|
|
14
|
-
${
|
|
15
|
-
|
|
164
|
+
message: \`Please provide a value for the \${italic("${option.name}")} option\`,
|
|
165
|
+
${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
166
|
+
` : ""}validate(val) {
|
|
16
167
|
if (!val || val.trim() === "") {
|
|
17
168
|
return "A value must be provided for this option";
|
|
18
169
|
}
|
|
@@ -24,44 +175,78 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
24
175
|
return;
|
|
25
176
|
}
|
|
26
177
|
|
|
27
|
-
options${
|
|
28
|
-
|
|
178
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
179
|
+
`;
|
|
180
|
+
}
|
|
181
|
+
}),
|
|
182
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
183
|
+
get when() {
|
|
184
|
+
return option.type === "number";
|
|
185
|
+
},
|
|
186
|
+
get children() {
|
|
187
|
+
return _alloy_js_core.code`
|
|
29
188
|
const value = await numeric({
|
|
30
|
-
message: \`Please provide a numeric value for the \${italic("${
|
|
31
|
-
${
|
|
32
|
-
|
|
189
|
+
message: \`Please provide a numeric value for the \${italic("${option.name}")} option\`,
|
|
190
|
+
${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
191
|
+
` : ""}
|
|
33
192
|
});
|
|
34
193
|
if (isCancel(value)) {
|
|
35
194
|
return;
|
|
36
195
|
}
|
|
37
196
|
|
|
38
|
-
options${
|
|
39
|
-
|
|
197
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
198
|
+
`;
|
|
199
|
+
}
|
|
200
|
+
}),
|
|
201
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
202
|
+
get when() {
|
|
203
|
+
return option.type === "boolean";
|
|
204
|
+
},
|
|
205
|
+
get children() {
|
|
206
|
+
return _alloy_js_core.code`
|
|
40
207
|
const value = await toggle({
|
|
41
|
-
message: \`Please select a value for the \${italic("${
|
|
42
|
-
${
|
|
43
|
-
|
|
208
|
+
message: \`Please select a value for the \${italic("${option.name}")} option\`,
|
|
209
|
+
${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
210
|
+
` : ""}
|
|
44
211
|
});
|
|
45
212
|
if (isCancel(value)) {
|
|
46
213
|
return;
|
|
47
214
|
}
|
|
48
215
|
|
|
49
|
-
options${
|
|
50
|
-
|
|
216
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
217
|
+
`;
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
];
|
|
221
|
+
} });
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
226
|
+
get when() {
|
|
227
|
+
return (option.type === "string" || option.type === "number") && option.variadic;
|
|
228
|
+
},
|
|
229
|
+
get children() {
|
|
230
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
231
|
+
get condition() {
|
|
232
|
+
return _alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
|
|
233
|
+
},
|
|
234
|
+
get children() {
|
|
235
|
+
return _alloy_js_core.code`
|
|
51
236
|
const value = await text({
|
|
52
|
-
message: \`Please provide one or more${
|
|
53
|
-
${
|
|
54
|
-
|
|
237
|
+
message: \`Please provide one or more${option.type === "number" ? " numeric" : ""} values for the \${italic("${option.name}")} option (values are separated by a \\",\\" character)\`,
|
|
238
|
+
${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
239
|
+
` : ""}validate(val) {
|
|
55
240
|
if (!val || val.trim() === "") {
|
|
56
241
|
return "A value must be provided for this option";
|
|
57
242
|
}
|
|
58
243
|
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
59
244
|
return "At least one value must be provided for this option";
|
|
60
245
|
}
|
|
61
|
-
${
|
|
246
|
+
${option.type === "number" ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
|
|
62
247
|
if (invalidIndex !== -1) {
|
|
63
248
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
64
|
-
}
|
|
249
|
+
} ` : ""}
|
|
65
250
|
return undefined;
|
|
66
251
|
}
|
|
67
252
|
});
|
|
@@ -69,22 +254,61 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
69
254
|
return;
|
|
70
255
|
}
|
|
71
256
|
|
|
72
|
-
options${
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
257
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value.split(",").map(value => value.trim()).filter(Boolean)${option.type === "number" ? `.map(Number)` : ""} ;
|
|
258
|
+
`;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
})];
|
|
263
|
+
}
|
|
264
|
+
})]
|
|
265
|
+
}),
|
|
266
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
267
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
268
|
+
get each() {
|
|
269
|
+
return command.args;
|
|
270
|
+
},
|
|
271
|
+
doubleHardline: true,
|
|
272
|
+
children: (arg) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
273
|
+
get when() {
|
|
274
|
+
return arg.required;
|
|
275
|
+
},
|
|
276
|
+
get children() {
|
|
277
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
278
|
+
get condition() {
|
|
279
|
+
return _alloy_js_core.code`!${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}`;
|
|
280
|
+
},
|
|
281
|
+
get children() {
|
|
282
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
283
|
+
get when() {
|
|
284
|
+
return arg.type === "boolean" || !arg.choices || arg.choices.length === 0;
|
|
285
|
+
},
|
|
286
|
+
get fallback() {
|
|
287
|
+
return _alloy_js_core.code`const value = await select({
|
|
288
|
+
message: \`Please select a value for the \${italic("${arg.name}")} argument\`,${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(arg.description)}\`,
|
|
289
|
+
` : ""}
|
|
290
|
+
options: [ ${arg.choices?.map((choice) => `{ value: ${JSON.stringify(choice)}, label: "${choice}", ${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`` : ""} }`).join(", ")} ]
|
|
77
291
|
});
|
|
78
292
|
if (isCancel(value)) {
|
|
79
293
|
return;
|
|
80
294
|
}
|
|
81
295
|
|
|
82
|
-
${(0,
|
|
83
|
-
|
|
296
|
+
${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
297
|
+
`;
|
|
298
|
+
},
|
|
299
|
+
get children() {
|
|
300
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Switch, { get children() {
|
|
301
|
+
return [
|
|
302
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
303
|
+
get when() {
|
|
304
|
+
return arg.type === "string";
|
|
305
|
+
},
|
|
306
|
+
get children() {
|
|
307
|
+
return _alloy_js_core.code`
|
|
84
308
|
const value = await text({
|
|
85
|
-
message: \`Please provide a value for the \${italic("${
|
|
86
|
-
${
|
|
87
|
-
|
|
309
|
+
message: \`Please provide a value for the \${italic("${arg.name}")} argument\`,
|
|
310
|
+
${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
311
|
+
` : ""}validate(val) {
|
|
88
312
|
if (!val || val.trim() === "") {
|
|
89
313
|
return "A value must be provided for this argument";
|
|
90
314
|
}
|
|
@@ -96,44 +320,78 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
96
320
|
return;
|
|
97
321
|
}
|
|
98
322
|
|
|
99
|
-
${(0,
|
|
100
|
-
|
|
323
|
+
${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
324
|
+
`;
|
|
325
|
+
}
|
|
326
|
+
}),
|
|
327
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
328
|
+
get when() {
|
|
329
|
+
return arg.type === "number";
|
|
330
|
+
},
|
|
331
|
+
get children() {
|
|
332
|
+
return _alloy_js_core.code`
|
|
101
333
|
const value = await numeric({
|
|
102
|
-
message: \`Please provide a numeric value for the \${italic("${
|
|
103
|
-
${
|
|
104
|
-
|
|
334
|
+
message: \`Please provide a numeric value for the \${italic("${arg.name}")} argument\`,
|
|
335
|
+
${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
336
|
+
` : ""}
|
|
105
337
|
});
|
|
106
338
|
if (isCancel(value)) {
|
|
107
339
|
return;
|
|
108
340
|
}
|
|
109
341
|
|
|
110
|
-
${(0,
|
|
111
|
-
|
|
342
|
+
${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
343
|
+
`;
|
|
344
|
+
}
|
|
345
|
+
}),
|
|
346
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
347
|
+
get when() {
|
|
348
|
+
return arg.type === "boolean";
|
|
349
|
+
},
|
|
350
|
+
get children() {
|
|
351
|
+
return _alloy_js_core.code`
|
|
112
352
|
const value = await toggle({
|
|
113
|
-
message: \`Please select a value for the \${italic("${
|
|
114
|
-
${
|
|
115
|
-
|
|
353
|
+
message: \`Please select a value for the \${italic("${arg.name}")} argument\`,
|
|
354
|
+
${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
355
|
+
` : ""}
|
|
116
356
|
});
|
|
117
357
|
if (isCancel(value)) {
|
|
118
358
|
return;
|
|
119
359
|
}
|
|
120
360
|
|
|
121
|
-
${(0,
|
|
122
|
-
|
|
361
|
+
${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
362
|
+
`;
|
|
363
|
+
}
|
|
364
|
+
})
|
|
365
|
+
];
|
|
366
|
+
} });
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
371
|
+
get when() {
|
|
372
|
+
return arg.variadic;
|
|
373
|
+
},
|
|
374
|
+
get children() {
|
|
375
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
376
|
+
get condition() {
|
|
377
|
+
return _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}.length === 0`;
|
|
378
|
+
},
|
|
379
|
+
get children() {
|
|
380
|
+
return _alloy_js_core.code`
|
|
123
381
|
const value = await text({
|
|
124
|
-
message: \`Please provide one or more${
|
|
125
|
-
${
|
|
126
|
-
|
|
382
|
+
message: \`Please provide one or more${arg.type === "number" ? " numeric" : ""} values for the \${italic("${arg.name}")} argument (values are separated by a \\",\\" character)\`,
|
|
383
|
+
${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
384
|
+
` : ""}validate(val) {
|
|
127
385
|
if (!val || val.trim() === "") {
|
|
128
386
|
return "A value must be provided for this argument";
|
|
129
387
|
}
|
|
130
388
|
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
131
389
|
return "At least one value must be provided for this argument";
|
|
132
390
|
}
|
|
133
|
-
${
|
|
391
|
+
${arg.type === "number" ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
|
|
134
392
|
if (invalidIndex !== -1) {
|
|
135
393
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
136
|
-
}
|
|
394
|
+
} ` : ""}
|
|
137
395
|
|
|
138
396
|
return undefined;
|
|
139
397
|
}
|
|
@@ -142,6 +400,50 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
142
400
|
return;
|
|
143
401
|
}
|
|
144
402
|
|
|
145
|
-
${(0,
|
|
146
|
-
|
|
147
|
-
|
|
403
|
+
${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value.split(",").map(value => value.trim()).filter(Boolean)${arg.type === "number" ? `.map(Number)` : arg.type === "boolean" ? `.map(Boolean)` : ""} ;
|
|
404
|
+
`;
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
})];
|
|
409
|
+
}
|
|
410
|
+
})]
|
|
411
|
+
}),
|
|
412
|
+
_alloy_js_core.code`writeLine(""); `,
|
|
413
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
414
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_command_validation_logic.CommandValidationLogic, { command }),
|
|
415
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
416
|
+
condition: _alloy_js_core.code`failures.length > 0`,
|
|
417
|
+
get children() {
|
|
418
|
+
return _alloy_js_core.code`error(\`The following validation failures were found while processing the user provided input, and must be corrected before the \${italic("${command.title}")} command can be executed: \\n\\n\${failures.map(failure => " - " + failure).join("\\n")}\`);
|
|
419
|
+
options.help = true; `;
|
|
420
|
+
}
|
|
421
|
+
})
|
|
422
|
+
];
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
})];
|
|
427
|
+
}
|
|
428
|
+
})];
|
|
429
|
+
}
|
|
430
|
+
})), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
431
|
+
get each() {
|
|
432
|
+
return Object.values(command.children);
|
|
433
|
+
},
|
|
434
|
+
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
435
|
+
get when() {
|
|
436
|
+
return child.virtual;
|
|
437
|
+
},
|
|
438
|
+
get fallback() {
|
|
439
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(CommandEntry, { command: child });
|
|
440
|
+
},
|
|
441
|
+
get children() {
|
|
442
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
|
|
443
|
+
}
|
|
444
|
+
})
|
|
445
|
+
})];
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
//#endregion
|
|
449
|
+
exports.CommandEntry = CommandEntry;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
1
|
import { CommandTree } from "@shell-shock/core";
|
|
3
2
|
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
4
3
|
|
|
@@ -9,7 +8,7 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
|
|
|
9
8
|
/**
|
|
10
9
|
* The command entry point for the Shell Shock project.
|
|
11
10
|
*/
|
|
12
|
-
declare function CommandEntry(props: CommandEntryProps):
|
|
11
|
+
declare function CommandEntry(props: CommandEntryProps): import("@alloy-js/core").Children;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { CommandEntry, CommandEntryProps };
|
|
15
14
|
//# sourceMappingURL=command-entry.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"mappings":";;;;UA6CiB,iBAAA,SAA0B,IAAA,CACzC,cAAA;EAGA,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,YAAA,CAAa,KAAA,EAAO,iBAAiB,4BAAA,QAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
1
|
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
2
|
import { CommandTree } from "@shell-shock/core";
|
|
4
3
|
|
|
@@ -9,7 +8,7 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
|
|
|
9
8
|
/**
|
|
10
9
|
* The command entry point for the Shell Shock project.
|
|
11
10
|
*/
|
|
12
|
-
declare function CommandEntry(props: CommandEntryProps):
|
|
11
|
+
declare function CommandEntry(props: CommandEntryProps): import("@alloy-js/core").Children;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { CommandEntry, CommandEntryProps };
|
|
15
14
|
//# sourceMappingURL=command-entry.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"mappings":""}
|