@shell-shock/preset-cli 0.6.0 → 0.7.0
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/components/banner-function-declaration.cjs +6 -6
- package/dist/components/banner-function-declaration.d.mts +2 -2
- package/dist/components/banner-function-declaration.d.mts.map +1 -1
- package/dist/components/banner-function-declaration.mjs +6 -6
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/command-entry.cjs +134 -127
- package/dist/components/command-entry.d.cts +2 -2
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +2 -2
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +133 -126
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.d.cts +3 -3
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/prompts-builtin.cjs +35 -10
- package/dist/components/prompts-builtin.d.cts +9 -9
- package/dist/components/prompts-builtin.d.cts.map +1 -1
- package/dist/components/prompts-builtin.d.mts +9 -9
- package/dist/components/prompts-builtin.d.mts.map +1 -1
- package/dist/components/prompts-builtin.mjs +46 -21
- package/dist/components/prompts-builtin.mjs.map +1 -1
- package/dist/components/virtual-command-entry.cjs +3 -3
- package/dist/components/virtual-command-entry.d.cts +2 -2
- package/dist/components/virtual-command-entry.mjs +2 -2
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-upgrade/dist/components/index.cjs +2 -0
- package/dist/plugin-upgrade/dist/components/index.mjs +4 -0
- package/dist/plugin-upgrade/dist/components/upgrade-builtin.cjs +661 -0
- package/dist/plugin-upgrade/dist/components/upgrade-builtin.mjs +655 -0
- package/dist/plugin-upgrade/dist/components/upgrade-builtin.mjs.map +1 -0
- package/dist/plugin-upgrade/dist/components/upgrade-command.cjs +96 -0
- package/dist/plugin-upgrade/dist/components/upgrade-command.mjs +96 -0
- package/dist/plugin-upgrade/dist/components/upgrade-command.mjs.map +1 -0
- package/dist/plugin-upgrade/dist/index.cjs +49 -0
- package/dist/plugin-upgrade/dist/index.mjs +49 -0
- package/dist/plugin-upgrade/dist/index.mjs.map +1 -0
- package/dist/types/plugin.d.cts +6 -10
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +6 -10
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +10 -10
|
@@ -3,18 +3,18 @@ import { VirtualCommandEntry } from "./virtual-command-entry.mjs";
|
|
|
3
3
|
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
4
|
import { For, Match, Show, Switch, code, computed } from "@alloy-js/core";
|
|
5
5
|
import { ElseIfClause, IfStatement } from "@alloy-js/typescript";
|
|
6
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
7
|
+
import defu from "defu";
|
|
8
|
+
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
6
9
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
10
|
+
import { joinPaths } from "@stryke/path/join";
|
|
7
11
|
import { isDynamicPathSegment } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
8
|
-
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
9
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
10
12
|
import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
11
13
|
import { CommandHandlerDeclaration, CommandValidationLogic } from "@shell-shock/preset-script/components/command-entry";
|
|
12
14
|
import { findFilePath, relativePath } from "@stryke/path/find";
|
|
13
|
-
import { joinPaths } from "@stryke/path/join";
|
|
14
15
|
import { replaceExtension } from "@stryke/path/replace";
|
|
15
16
|
import { camelCase } from "@stryke/string-format/camel-case";
|
|
16
17
|
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
17
|
-
import defu from "defu";
|
|
18
18
|
|
|
19
19
|
//#region src/components/command-entry.tsx
|
|
20
20
|
/**
|
|
@@ -93,37 +93,42 @@ function CommandEntry(props) {
|
|
|
93
93
|
get children() {
|
|
94
94
|
return createComponent(CommandValidationLogic, { command });
|
|
95
95
|
}
|
|
96
|
-
}), createComponent(
|
|
97
|
-
get
|
|
98
|
-
return
|
|
96
|
+
}), createComponent(Show, {
|
|
97
|
+
get when() {
|
|
98
|
+
return Object.values(command.options ?? {}).filter((option) => !option.optional).length > 0 || Object.values(command.arguments ?? {}).filter((argument) => !argument.optional).length > 0;
|
|
99
99
|
},
|
|
100
100
|
get children() {
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
get
|
|
116
|
-
return
|
|
101
|
+
return createComponent(ElseIfClause, {
|
|
102
|
+
get condition() {
|
|
103
|
+
return code`!isHelp && (${Object.values(command.options ?? {}).filter((option) => !option.optional).map((option) => (option.kind === ReflectionKind.string || option.kind === ReflectionKind.number) && option.variadic ? `(!options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} || options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.length === 0)` : `options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} === undefined`).join(" || ")}${Object.values(command.options ?? {}).filter((option) => !option.optional).length > 0 && Object.values(command.arguments ?? {}).filter((argument) => !argument.optional).length > 0 ? " || " : ""}${Object.values(command.arguments ?? {}).filter((argument) => !argument.optional).map((argument) => (argument.kind === ReflectionKind.string || argument.kind === ReflectionKind.number) && argument.variadic ? `(!${camelCase(argument.name)} || ${camelCase(argument.name)}.length === 0)` : `${camelCase(argument.name)} === undefined`).join(" || ")}) `;
|
|
104
|
+
},
|
|
105
|
+
get children() {
|
|
106
|
+
return [
|
|
107
|
+
code`writeLine(""); `,
|
|
108
|
+
createComponent(Spacing, {}),
|
|
109
|
+
createComponent(For, {
|
|
110
|
+
get each() {
|
|
111
|
+
return Object.values(command.options ?? {});
|
|
112
|
+
},
|
|
113
|
+
doubleHardline: true,
|
|
114
|
+
children: (option) => [createComponent(Show, {
|
|
115
|
+
get when() {
|
|
116
|
+
return !option.optional;
|
|
117
117
|
},
|
|
118
118
|
get children() {
|
|
119
|
-
return createComponent(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
119
|
+
return [createComponent(IfStatement, {
|
|
120
|
+
get condition() {
|
|
121
|
+
return code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}`;
|
|
122
|
+
},
|
|
123
|
+
get children() {
|
|
124
|
+
return createComponent(Switch, { get children() {
|
|
125
|
+
return [
|
|
126
|
+
createComponent(Match, {
|
|
127
|
+
get when() {
|
|
128
|
+
return option.kind === ReflectionKind.string;
|
|
129
|
+
},
|
|
130
|
+
get children() {
|
|
131
|
+
return code`
|
|
127
132
|
const value = await text({
|
|
128
133
|
message: "Please provide a value for the \\"${option.name}\\" option",
|
|
129
134
|
${option.description ? `description: "${option.description}",
|
|
@@ -141,14 +146,14 @@ function CommandEntry(props) {
|
|
|
141
146
|
|
|
142
147
|
options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} = value;
|
|
143
148
|
`;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
}
|
|
150
|
+
}),
|
|
151
|
+
createComponent(Match, {
|
|
152
|
+
get when() {
|
|
153
|
+
return option.kind === ReflectionKind.number;
|
|
154
|
+
},
|
|
155
|
+
get children() {
|
|
156
|
+
return code`
|
|
152
157
|
const value = await numeric({
|
|
153
158
|
message: "Please provide a numeric value for the \\"${option.name}\\" option",
|
|
154
159
|
${option.description ? `description: "${option.description}",
|
|
@@ -160,14 +165,14 @@ function CommandEntry(props) {
|
|
|
160
165
|
|
|
161
166
|
options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} = value;
|
|
162
167
|
`;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
}
|
|
169
|
+
}),
|
|
170
|
+
createComponent(Match, {
|
|
171
|
+
get when() {
|
|
172
|
+
return option.kind === ReflectionKind.boolean;
|
|
173
|
+
},
|
|
174
|
+
get children() {
|
|
175
|
+
return code`
|
|
171
176
|
const value = await toggle({
|
|
172
177
|
message: "Please select a value for the \\"${option.name}\\" option",
|
|
173
178
|
${option.description ? `description: "${option.description}",
|
|
@@ -179,22 +184,22 @@ function CommandEntry(props) {
|
|
|
179
184
|
|
|
180
185
|
options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} = value;
|
|
181
186
|
`;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
},
|
|
191
|
-
get children() {
|
|
192
|
-
return createComponent(ElseIfClause, {
|
|
193
|
-
get condition() {
|
|
194
|
-
return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.length === 0`;
|
|
187
|
+
}
|
|
188
|
+
})
|
|
189
|
+
];
|
|
190
|
+
} });
|
|
191
|
+
}
|
|
192
|
+
}), createComponent(Show, {
|
|
193
|
+
get when() {
|
|
194
|
+
return (option.kind === ReflectionKind.string || option.kind === ReflectionKind.number) && option.variadic;
|
|
195
195
|
},
|
|
196
196
|
get children() {
|
|
197
|
-
return
|
|
197
|
+
return createComponent(ElseIfClause, {
|
|
198
|
+
get condition() {
|
|
199
|
+
return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.length === 0`;
|
|
200
|
+
},
|
|
201
|
+
get children() {
|
|
202
|
+
return code`
|
|
198
203
|
const value = await text({
|
|
199
204
|
message: "Please provide one or more${option.kind === ReflectionKind.number ? " numeric" : ""} values for the \\"${option.name}\\" option (values are separated by a \\",\\" character)",
|
|
200
205
|
${option.description ? `description: "${option.description}",
|
|
@@ -218,37 +223,37 @@ function CommandEntry(props) {
|
|
|
218
223
|
|
|
219
224
|
options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} = value.split(",").map(value => value.trim()).filter(Boolean)${option.kind === ReflectionKind.number ? `.map(Number)` : ""} ;
|
|
220
225
|
`;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
221
228
|
}
|
|
222
|
-
});
|
|
229
|
+
})];
|
|
223
230
|
}
|
|
224
|
-
})]
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
get when() {
|
|
236
|
-
return !argument.optional;
|
|
237
|
-
},
|
|
238
|
-
get children() {
|
|
239
|
-
return [createComponent(IfStatement, {
|
|
240
|
-
get condition() {
|
|
241
|
-
return code`!${camelCase(argument.name)}`;
|
|
231
|
+
})]
|
|
232
|
+
}),
|
|
233
|
+
createComponent(Spacing, {}),
|
|
234
|
+
createComponent(For, {
|
|
235
|
+
get each() {
|
|
236
|
+
return command.arguments;
|
|
237
|
+
},
|
|
238
|
+
doubleHardline: true,
|
|
239
|
+
children: (argument) => [createComponent(Show, {
|
|
240
|
+
get when() {
|
|
241
|
+
return !argument.optional;
|
|
242
242
|
},
|
|
243
243
|
get children() {
|
|
244
|
-
return createComponent(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
244
|
+
return [createComponent(IfStatement, {
|
|
245
|
+
get condition() {
|
|
246
|
+
return code`!${camelCase(argument.name)}`;
|
|
247
|
+
},
|
|
248
|
+
get children() {
|
|
249
|
+
return createComponent(Switch, { get children() {
|
|
250
|
+
return [
|
|
251
|
+
createComponent(Match, {
|
|
252
|
+
get when() {
|
|
253
|
+
return argument.kind === ReflectionKind.string;
|
|
254
|
+
},
|
|
255
|
+
get children() {
|
|
256
|
+
return code`
|
|
252
257
|
const value = await text({
|
|
253
258
|
message: "Please provide a value for the \\"${argument.name}\\" argument",
|
|
254
259
|
${argument.description ? `description: "${argument.description}",
|
|
@@ -266,14 +271,14 @@ function CommandEntry(props) {
|
|
|
266
271
|
|
|
267
272
|
${camelCase(argument.name)} = value;
|
|
268
273
|
`;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
274
|
+
}
|
|
275
|
+
}),
|
|
276
|
+
createComponent(Match, {
|
|
277
|
+
get when() {
|
|
278
|
+
return argument.kind === ReflectionKind.number;
|
|
279
|
+
},
|
|
280
|
+
get children() {
|
|
281
|
+
return code`
|
|
277
282
|
const value = await numeric({
|
|
278
283
|
message: "Please provide a numeric value for the \\"${argument.name}\\" argument",
|
|
279
284
|
${argument.description ? `description: "${argument.description}",
|
|
@@ -285,14 +290,14 @@ function CommandEntry(props) {
|
|
|
285
290
|
|
|
286
291
|
${camelCase(argument.name)} = value;
|
|
287
292
|
`;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
293
|
+
}
|
|
294
|
+
}),
|
|
295
|
+
createComponent(Match, {
|
|
296
|
+
get when() {
|
|
297
|
+
return argument.kind === ReflectionKind.boolean;
|
|
298
|
+
},
|
|
299
|
+
get children() {
|
|
300
|
+
return code`
|
|
296
301
|
const value = await toggle({
|
|
297
302
|
message: "Please select a value for the \\"${argument.name}\\" argument",
|
|
298
303
|
${argument.description ? `description: "${argument.description}",
|
|
@@ -304,22 +309,22 @@ function CommandEntry(props) {
|
|
|
304
309
|
|
|
305
310
|
${camelCase(argument.name)} = value;
|
|
306
311
|
`;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
},
|
|
316
|
-
get children() {
|
|
317
|
-
return createComponent(ElseIfClause, {
|
|
318
|
-
get condition() {
|
|
319
|
-
return code`${camelCase(argument.name)}.length === 0`;
|
|
312
|
+
}
|
|
313
|
+
})
|
|
314
|
+
];
|
|
315
|
+
} });
|
|
316
|
+
}
|
|
317
|
+
}), createComponent(Show, {
|
|
318
|
+
get when() {
|
|
319
|
+
return (argument.kind === ReflectionKind.string || argument.kind === ReflectionKind.number) && argument.variadic;
|
|
320
320
|
},
|
|
321
321
|
get children() {
|
|
322
|
-
return
|
|
322
|
+
return createComponent(ElseIfClause, {
|
|
323
|
+
get condition() {
|
|
324
|
+
return code`${camelCase(argument.name)}.length === 0`;
|
|
325
|
+
},
|
|
326
|
+
get children() {
|
|
327
|
+
return code`
|
|
323
328
|
const value = await text({
|
|
324
329
|
message: "Please provide one or more${argument.kind === ReflectionKind.number ? " numeric" : ""} (values are separated by a \\",\\" character)",
|
|
325
330
|
${argument.description ? `description: "${argument.description}",
|
|
@@ -344,16 +349,18 @@ function CommandEntry(props) {
|
|
|
344
349
|
|
|
345
350
|
${camelCase(argument.name)} = value.split(",").map(value => value.trim()).filter(Boolean)${argument.kind === ReflectionKind.number ? `.map(Number)` : ""} ;
|
|
346
351
|
`;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
347
354
|
}
|
|
348
|
-
});
|
|
355
|
+
})];
|
|
349
356
|
}
|
|
350
|
-
})]
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
+
})]
|
|
358
|
+
}),
|
|
359
|
+
code`writeLine(""); `,
|
|
360
|
+
createComponent(Spacing, {})
|
|
361
|
+
];
|
|
362
|
+
}
|
|
363
|
+
});
|
|
357
364
|
}
|
|
358
365
|
})];
|
|
359
366
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.mjs","names":["code","computed","For","Match","Show","Switch","ElseIfClause","IfStatement","ReflectionKind","Spacing","usePowerlines","EntryFile","isDynamicPathSegment","CommandHandlerDeclaration","CommandValidationLogic","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","pascalCase","defu","BannerFunctionDeclaration","VirtualCommandEntry","CommandEntry","props","command","imports","builtinImports","rest","context","filePath","segments","filter","segment","join","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$createComponent","_$mergeProps","path","name","prompts","env","console","utils","children","_$createIntrinsic","banner","condition","Object","values","options","option","optional","map","kind","string","number","variadic","includes","length","arguments","argument","each","doubleHardline","when","description","boolean","child","isVirtual","fallback"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Match, Show, Switch } from \"@alloy-js/core\";\nimport { ElseIfClause, IfStatement } from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport {\n CommandHandlerDeclaration,\n CommandValidationLogic\n} from \"@shell-shock/preset-script/components/command-entry\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`,\n prompts: \"prompts\"\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n console: [\n \"debug\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isInteractive\",\n \"isHelp\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ],\n prompts: [\"text\", \"numeric\", \"toggle\", \"select\", \"isCancel\", \"sleep\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await banner(); `}>\n <IfStatement condition={code`!isInteractive`}>\n <CommandValidationLogic command={command} />\n </IfStatement>\n <ElseIfClause\n condition={code`!isHelp && (${Object.values(command.options ?? {})\n .filter(option => !option.optional)\n .map(option =>\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n ? `(!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } || options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0)`\n : `options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } === undefined`\n )\n .join(\" || \")}${\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 &&\n Object.values(command.arguments ?? {}).filter(\n argument => !argument.optional\n ).length > 0\n ? \" || \"\n : \"\"\n }${Object.values(command.arguments ?? {})\n .filter(argument => !argument.optional)\n .map(argument =>\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ? `(!${camelCase(\n argument.name\n )} || ${camelCase(argument.name)}.length === 0)`\n : `${camelCase(argument.name)} === undefined`\n )\n .join(\" || \")}) `}>\n {code`writeLine(\"\"); `}\n <Spacing />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n <Switch>\n <Match\n when={option.kind === ReflectionKind.string}>{code`\n const value = await text({\n message: \"Please provide a value for the \\\\\"${option.name}\\\\\" option\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={option.kind === ReflectionKind.number}>{code`\n const value = await numeric({\n message: \"Please provide a numeric value for the \\\\\"${option.name}\\\\\" option\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={option.kind === ReflectionKind.boolean}>{code`\n const value = await toggle({\n message: \"Please select a value for the \\\\\"${\n option.name\n }\\\\\" option\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n </Switch>\n </IfStatement>\n <Show\n when={\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`\n const value = await text({\n message: \"Please provide one or more${\n option.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } values for the \\\\\"${option.name}\\\\\" option (values are separated by a \\\\\",\\\\\" character)\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this option\";\n }\n ${\n option.kind === ReflectionKind.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n option.kind === ReflectionKind.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n <Spacing />\n <For each={command.arguments} doubleHardline>\n {argument => (\n <>\n <Show when={!argument.optional}>\n <IfStatement condition={code`!${camelCase(argument.name)}`}>\n <Switch>\n <Match\n when={argument.kind === ReflectionKind.string}>{code`\n const value = await text({\n message: \"Please provide a value for the \\\\\"${argument.name}\\\\\" argument\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n <Match\n when={argument.kind === ReflectionKind.number}>{code`\n const value = await numeric({\n message: \"Please provide a numeric value for the \\\\\"${argument.name}\\\\\" argument\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n <Match\n when={argument.kind === ReflectionKind.boolean}>{code`\n const value = await toggle({\n message: \"Please select a value for the \\\\\"${argument.name}\\\\\" argument\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n </Switch>\n </IfStatement>\n <Show\n when={\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(argument.name)}.length === 0`}>\n {code`\n const value = await text({\n message: \"Please provide one or more${\n argument.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } (values are separated by a \\\\\",\\\\\" character)\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this argument\";\n }\n ${\n argument.kind === ReflectionKind.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n argument.kind === ReflectionKind.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n {code`writeLine(\"\"); `}\n <Spacing />\n </ElseIfClause>\n </CommandHandlerDeclaration>\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAgBwB,aAAaC,OAA0B;CACrD,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUpB,eAAiC;CACjD,MAAMqB,WAAW9B,eACfgB,UACES,QAAQM,SACLC,QAAOC,YAAW,CAACtB,qBAAqBsB,QAAQ,CAAC,CACjDC,KAAK,IAAI,EACZ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ElBvC,cAAY;eAAA,IACXkD,YAAS;AAAA,uBAAExD,IAAI,GAAGmB,UAAUmD,SAAStB,KAAK,CAAA;;eAAe,IAAAK,WAAA;AAAA,uBACxDrD,IAAI;;oEAGGsE,SAASP,SAASvD,eAAeyD,SAC7B,aACA,GAAE;gCAGNK,SAASI,cACL,iBAAiBJ,SAASI,YAAW;kCAErC,GAAE;;;;;;;kCASJJ,SAASP,SAASvD,eAAeyD,SAC7B;;;0CAIA,GAAE;;;;;;;;;8BAUV9C,UAAUmD,SAAStB,KAAK,CAAA,gEACxBsB,SAASP,SAASvD,eAAeyD,SAC7B,iBACA,GAAE;;;eAET,CAAA;;aAAA,CAAA,CAAA;;WAAA,CAAA,CAAA;UAKZ,CAAA;SAEFjE,IAAI;SAAiB6C,gBACrBpC,SAAO,EAAA,CAAA;SAAA;;OAAA,CAAA,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAoC,gBAIb3C,KAAG;EAAA,IAACqE,OAAI;AAAA,UAAEd,OAAOC,OAAOhC,QAAQ2B,SAAS;;EAAAA,WACvCuB,UAAK/B,gBACHzC,MAAI;GAAA,IACHqE,OAAI;AAAA,WAAEG,MAAMC;;GAAS,IACrBC,WAAQ;AAAA,WAAAjC,gBAAGrB,cAAY,EAACE,SAASkD,OAAK,CAAA;;GAAA,IAAAvB,WAAA;AAAA,WAAAR,gBACrCtB,qBAAmB,EAACG,SAASkD,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"command-entry.mjs","names":["code","computed","For","Match","Show","Switch","ElseIfClause","IfStatement","ReflectionKind","Spacing","usePowerlines","EntryFile","isDynamicPathSegment","CommandHandlerDeclaration","CommandValidationLogic","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","pascalCase","defu","BannerFunctionDeclaration","VirtualCommandEntry","CommandEntry","props","command","imports","builtinImports","rest","context","filePath","segments","filter","segment","join","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$createComponent","_$mergeProps","path","name","prompts","env","console","utils","children","_$createIntrinsic","banner","condition","when","Object","values","options","option","optional","length","arguments","argument","map","kind","string","number","variadic","includes","each","doubleHardline","description","boolean","child","isVirtual","fallback"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Match, Show, Switch } from \"@alloy-js/core\";\nimport { ElseIfClause, IfStatement } from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport {\n CommandHandlerDeclaration,\n CommandValidationLogic\n} from \"@shell-shock/preset-script/components/command-entry\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`,\n prompts: \"prompts\"\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n console: [\n \"debug\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isInteractive\",\n \"isHelp\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ],\n prompts: [\"text\", \"numeric\", \"toggle\", \"select\", \"isCancel\", \"sleep\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await banner(); `}>\n <IfStatement condition={code`!isInteractive`}>\n <CommandValidationLogic command={command} />\n </IfStatement>\n <Show\n when={\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 ||\n Object.values(command.arguments ?? {}).filter(\n argument => !argument.optional\n ).length > 0\n }>\n <ElseIfClause\n condition={code`!isHelp && (${Object.values(command.options ?? {})\n .filter(option => !option.optional)\n .map(option =>\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n ? `(!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } || options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0)`\n : `options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } === undefined`\n )\n .join(\" || \")}${\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 &&\n Object.values(command.arguments ?? {}).filter(\n argument => !argument.optional\n ).length > 0\n ? \" || \"\n : \"\"\n }${Object.values(command.arguments ?? {})\n .filter(argument => !argument.optional)\n .map(argument =>\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ? `(!${camelCase(\n argument.name\n )} || ${camelCase(argument.name)}.length === 0)`\n : `${camelCase(argument.name)} === undefined`\n )\n .join(\" || \")}) `}>\n {code`writeLine(\"\"); `}\n <Spacing />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n <Switch>\n <Match\n when={option.kind === ReflectionKind.string}>{code`\n const value = await text({\n message: \"Please provide a value for the \\\\\"${option.name}\\\\\" option\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={option.kind === ReflectionKind.number}>{code`\n const value = await numeric({\n message: \"Please provide a numeric value for the \\\\\"${option.name}\\\\\" option\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={option.kind === ReflectionKind.boolean}>{code`\n const value = await toggle({\n message: \"Please select a value for the \\\\\"${\n option.name\n }\\\\\" option\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n </Switch>\n </IfStatement>\n <Show\n when={\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`\n const value = await text({\n message: \"Please provide one or more${\n option.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } values for the \\\\\"${option.name}\\\\\" option (values are separated by a \\\\\",\\\\\" character)\",\n ${\n option.description\n ? `description: \"${option.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this option\";\n }\n ${\n option.kind === ReflectionKind.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n option.kind === ReflectionKind.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n <Spacing />\n <For each={command.arguments} doubleHardline>\n {argument => (\n <>\n <Show when={!argument.optional}>\n <IfStatement\n condition={code`!${camelCase(argument.name)}`}>\n <Switch>\n <Match\n when={\n argument.kind === ReflectionKind.string\n }>{code`\n const value = await text({\n message: \"Please provide a value for the \\\\\"${argument.name}\\\\\" argument\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n <Match\n when={\n argument.kind === ReflectionKind.number\n }>{code`\n const value = await numeric({\n message: \"Please provide a numeric value for the \\\\\"${argument.name}\\\\\" argument\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n <Match\n when={\n argument.kind === ReflectionKind.boolean\n }>{code`\n const value = await toggle({\n message: \"Please select a value for the \\\\\"${argument.name}\\\\\" argument\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value;\n `}</Match>\n </Switch>\n </IfStatement>\n <Show\n when={\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(argument.name)}.length === 0`}>\n {code`\n const value = await text({\n message: \"Please provide one or more${\n argument.kind === ReflectionKind.number\n ? \" numeric\"\n : \"\"\n } (values are separated by a \\\\\",\\\\\" character)\",\n ${\n argument.description\n ? `description: \"${argument.description}\",\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this argument\";\n }\n ${\n argument.kind === ReflectionKind.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(argument.name)} = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n argument.kind === ReflectionKind.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n {code`writeLine(\"\"); `}\n <Spacing />\n </ElseIfClause>\n </Show>\n </CommandHandlerDeclaration>\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAgBwB,aAAaC,OAA0B;CACrD,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUpB,eAAiC;CACjD,MAAMqB,WAAW9B,eACfgB,UACES,QAAQM,SACLC,QAAOC,YAAW,CAACtB,qBAAqBsB,QAAQ,CAAC,CACjDC,KAAK,IAAI,EACZ,WAEJ,CAAC;CACD,MAAMC,oBAAoBnC,eACxBiB,iBACEF,aACEC,UAAUa,QAAQO,WAAWtB,aAAagB,SAASO,MAAM,CAAC,EAC1DZ,QAAQa,MAAMC,OAAOC,QAAQf,QAAQa,MAAME,KAE/C,CACF,CAAC;CACD,MAAMC,iBAAiBzC,gBAAgB;EACrC,GAAGyB,QAAQa;EACXI,QAAQjB,QAAQkB;EACjB,EAAE;AAEH,QAAA,CAAAC,gBAEKlC,WAASmC,WACJjB,MAAI;EAAA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,GAAGmB,UAAU8C,SAASjB,KAAK,CAAA;;iBAAe,IAAAK,WAAA;AAAA,yBACxDrD,IAAI;;oEAGCiE,SAASE,SAAS3D,eAAe6D,SAC7B,aACA,GAAE;gCAGNJ,SAASS,cACL,iBAAiBT,SAASS,YAAW;kCAErC,GAAE;;;;;;;kCASJT,SAASE,SAAS3D,eAAe6D,SAC7B;;;0CAIA,GAAE;;;;;;;;;8BAUVlD,UAAU8C,SAASjB,KAAK,CAAA,gEACxBiB,SAASE,SAAS3D,eAAe6D,SAC7B,iBACA,GAAE;;;iBAET,CAAA;;eAAA,CAAA,CAAA;;aAAA,CAAA,CAAA;YAKV,CAAA;WAEFrE,IAAI;WAAiB6C,gBACrBpC,SAAO,EAAA,CAAA;WAAA;;SAAA,CAAA;;OAAA,CAAA,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAoC,gBAKf3C,KAAG;EAAA,IAACsE,OAAI;AAAA,UAAEd,OAAOC,OAAOjC,QAAQ2B,SAAS;;EAAAA,WACvCuB,UAAK/B,gBACHzC,MAAI;GAAA,IACHqD,OAAI;AAAA,WAAEmB,MAAMC;;GAAS,IACrBC,WAAQ;AAAA,WAAAjC,gBAAGrB,cAAY,EAACE,SAASkD,OAAK,CAAA;;GAAA,IAAAvB,WAAA;AAAA,WAAAR,gBACrCtB,qBAAmB,EAACG,SAASkD,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core10 from "@alloy-js/core";
|
|
2
2
|
import { CommandTree } from "@shell-shock/core/types/command";
|
|
3
3
|
import { CommandRouterProps } from "@shell-shock/preset-script/components/command-router";
|
|
4
4
|
|
|
@@ -6,11 +6,11 @@ import { CommandRouterProps } from "@shell-shock/preset-script/components/comman
|
|
|
6
6
|
interface CommandRouterSelectOptionsProps {
|
|
7
7
|
commands?: Record<string, CommandTree>;
|
|
8
8
|
}
|
|
9
|
-
declare function CommandRouterSelectOptions(props: CommandRouterSelectOptionsProps):
|
|
9
|
+
declare function CommandRouterSelectOptions(props: CommandRouterSelectOptionsProps): _alloy_js_core10.Children;
|
|
10
10
|
/**
|
|
11
11
|
* A component that renders a command router interface, allowing users to select and execute commands from a provided list of commands and segments. This component serves as a wrapper around the base CommandRouter, adding additional UI elements and logic for command selection.
|
|
12
12
|
*/
|
|
13
|
-
declare function CommandRouter(props: CommandRouterProps):
|
|
13
|
+
declare function CommandRouter(props: CommandRouterProps): _alloy_js_core10.Children;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { CommandRouter, CommandRouterSelectOptions, CommandRouterSelectOptionsProps };
|
|
16
16
|
//# sourceMappingURL=command-router.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-router.d.cts","names":[],"sources":["../../src/components/command-router.tsx"],"sourcesContent":[],"mappings":";;;;;UA4BiB,+BAAA;aACJ,eAAe;;AADX,iBAID,0BAAA,CAHY,KAAA,EAInB,+BAJU,CAAA,EAIqB,
|
|
1
|
+
{"version":3,"file":"command-router.d.cts","names":[],"sources":["../../src/components/command-router.tsx"],"sourcesContent":[],"mappings":";;;;;UA4BiB,+BAAA;aACJ,eAAe;;AADX,iBAID,0BAAA,CAHY,KAAA,EAInB,+BAJU,CAAA,EAIqB,gBAAA,CAAA,QAJrB;AAGnB;AAyBA;;iBAAgB,aAAA,QAAqB,qBAAkB,gBAAA,CAAA"}
|