@shell-shock/preset-cli 0.9.33 → 0.9.35

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.
Files changed (65) hide show
  1. package/README.md +16 -7
  2. package/dist/command-entry-BCDDI3RN.mjs +548 -0
  3. package/dist/command-entry-BCDDI3RN.mjs.map +1 -0
  4. package/dist/command-entry-iZ5O5Iza.cjs +558 -0
  5. package/dist/components/banner-builtin.cjs +39 -14
  6. package/dist/components/banner-builtin.d.cts +1 -2
  7. package/dist/components/banner-builtin.d.cts.map +1 -1
  8. package/dist/components/banner-builtin.d.mts +1 -2
  9. package/dist/components/banner-builtin.mjs +6 -6
  10. package/dist/components/command-entry.cjs +2 -447
  11. package/dist/components/command-entry.d.cts +1 -2
  12. package/dist/components/command-entry.d.cts.map +1 -1
  13. package/dist/components/command-entry.d.mts +1 -2
  14. package/dist/components/command-entry.mjs +2 -446
  15. package/dist/components/command-router.cjs +6 -6
  16. package/dist/components/command-router.d.cts +0 -1
  17. package/dist/components/command-router.d.cts.map +1 -1
  18. package/dist/components/command-router.d.mts +0 -1
  19. package/dist/components/command-router.mjs +3 -3
  20. package/dist/components/index.cjs +3 -4
  21. package/dist/components/index.mjs +1 -2
  22. package/dist/components/update-builtin.cjs +7 -7
  23. package/dist/components/update-builtin.d.cts +0 -1
  24. package/dist/components/update-builtin.d.cts.map +1 -1
  25. package/dist/components/update-builtin.d.mts +0 -1
  26. package/dist/components/update-builtin.mjs +5 -5
  27. package/dist/components/virtual-command-entry.cjs +2 -114
  28. package/dist/components/virtual-command-entry.d.cts +1 -2
  29. package/dist/components/virtual-command-entry.d.cts.map +1 -1
  30. package/dist/components/virtual-command-entry.d.mts +1 -2
  31. package/dist/components/virtual-command-entry.mjs +2 -113
  32. package/dist/generator.cjs +158 -0
  33. package/dist/generator.d.cts +16 -0
  34. package/dist/generator.d.cts.map +1 -0
  35. package/dist/generator.d.mts +16 -0
  36. package/dist/generator.d.mts.map +1 -0
  37. package/dist/generator.mjs +156 -0
  38. package/dist/generator.mjs.map +1 -0
  39. package/dist/helpers/get-global-options.cjs +1 -0
  40. package/dist/helpers/get-global-options.d.cts +15 -0
  41. package/dist/helpers/get-global-options.d.cts.map +1 -0
  42. package/dist/helpers/get-global-options.d.mts +15 -0
  43. package/dist/helpers/get-global-options.d.mts.map +1 -0
  44. package/dist/helpers/get-global-options.mjs +4 -4
  45. package/dist/index.cjs +20 -130
  46. package/dist/index.d.cts +3 -3
  47. package/dist/index.d.cts.map +1 -1
  48. package/dist/index.d.mts +3 -3
  49. package/dist/index.mjs +25 -129
  50. package/dist/plugin-BUwcMpPx.d.mts +100 -0
  51. package/dist/plugin-BUwcMpPx.d.mts.map +1 -0
  52. package/dist/plugin-Bsdv5DH-.d.cts +100 -0
  53. package/dist/plugin-Bsdv5DH-.d.cts.map +1 -0
  54. package/dist/types/index.cjs +1 -0
  55. package/dist/types/index.d.cts +1 -1
  56. package/dist/types/index.d.mts +1 -1
  57. package/dist/types/index.mjs +2 -0
  58. package/dist/types/plugin.d.cts +2 -101
  59. package/dist/types/plugin.d.mts +2 -101
  60. package/package.json +53 -25
  61. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  62. package/dist/components/command-entry.mjs.map +0 -1
  63. package/dist/components/virtual-command-entry.mjs.map +0 -1
  64. package/dist/types/plugin.d.cts.map +0 -1
  65. package/dist/types/plugin.d.mts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"banner-builtin.d.cts","names":[],"sources":["../../src/components/banner-builtin.tsx"],"mappings":";;;;;;;AA0CA;iBAAgB,6BAAA,CACd,KAAA,EAAO,IAAI,CACT,kCAAA,kEAED,QAAA;AAAA,KAsES,kBAAA,GAAqB,IAAA,CAC/B,gBAAA;EA1EW;;;EAgFX,OAAA,EAAS,WAAA;AAAA;;AA7ER;AAsEH;iBAagB,aAAA,CAAc,KAAA,EAAO,kBAAkB,4BAAA,QAAA"}
1
+ {"version":3,"file":"banner-builtin.d.cts","names":[],"sources":["../../src/components/banner-builtin.tsx"],"mappings":";;;;;;;iBA6CgB,8BACd,OAAO,KACL,oGAED;KAsES,qBAAqB,KAC/B;;;;EAMA,SAAS;;;;;iBAMK,cAAc,OAAO,8CAAkB"}
@@ -1,7 +1,6 @@
1
+ import { BuiltinFileProps } from "@shell-shock/core/contexts/power-plant";
1
2
  import { BannerFunctionBodyDeclarationProps } from "@shell-shock/plugin-banner/components/banner-function-declaration";
2
- import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
3
3
  import { CommandTree } from "@shell-shock/core";
4
-
5
4
  //#region src/components/banner-builtin.d.ts
6
5
  /**
7
6
  * A component to generate the `banner` function in the `shell-shock:console` builtin module.
@@ -1,15 +1,15 @@
1
+ import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils";
2
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
1
3
  import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
2
4
  import { Show, code, computed, splitProps } from "@alloy-js/core";
3
5
  import { VarDeclaration } from "@alloy-js/typescript";
4
- import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils";
5
- import { isSetObject } from "@stryke/type-checks/is-set-object";
6
- import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
7
- import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
6
+ import { Spacing } from "@power-plant/alloy-js/core/components/spacing";
7
+ import { usePowerlines } from "@shell-shock/core/contexts/power-plant";
8
8
  import { BannerBuiltin as BannerBuiltin$1 } from "@shell-shock/plugin-banner/components/banner-builtin";
9
9
  import { BannerFunctionBodyDeclaration as BannerFunctionBodyDeclaration$1, BannerFunctionDeclarationWrapper } from "@shell-shock/plugin-banner/components/banner-function-declaration";
10
10
  import { useTheme } from "@shell-shock/plugin-theme/contexts/theme";
11
11
  import { isSetString } from "@stryke/type-checks/is-set-string";
12
- import defu from "defu";
12
+ import { defu } from "defu";
13
13
  import figlet from "figlet";
14
14
  import stripAnsi from "strip-ansi";
15
15
 
@@ -65,7 +65,7 @@ function BannerBuiltin(props) {
65
65
  const [{ command, children }, rest] = splitProps(props, ["command", "children"]);
66
66
  const context = usePowerlines();
67
67
  const titleLines = computed(() => {
68
- const result = figlet.textSync(isSetObject(context.config.banner) && isSetString(context.config.banner.override) ? context.config.banner.override : isSetString(context.config.banner) ? context.config.banner : isSetObject(context.config.banner) && isSetString(context.config.banner.text) ? context.config.banner.text : getAppTitle(context, true), defu(isSetObject(context.config.banner) ? context.config.banner : {}, { font: "ANSI Compact" }));
68
+ const result = figlet.textSync(isSetObject(context.config.banner) && isSetString(context.config.banner.override) ? context.config.banner.override : isSetString(context.config.banner) ? context.config.banner : getAppTitle(context, true), defu(isSetObject(context.config.banner) ? context.config.banner : {}, { font: "ANSI Compact" }));
69
69
  if (!result) return [`${getAppTitle(context, true)} Command-Line Interface`];
70
70
  const lines = result.trim().split("\n");
71
71
  const maxLength = Math.max(...lines.map((line) => stripAnsi(line).length));
@@ -1,449 +1,4 @@
1
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 defu = require("defu");
12
- defu = require_runtime.__toESM(defu, 1);
13
- let _powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
14
- let _shell_shock_core_components_command_validation_logic = require("@shell-shock/core/components/command-validation-logic");
15
- let _shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
16
- let _stryke_path_find = require("@stryke/path/find");
17
- let _stryke_path_replace = require("@stryke/path/replace");
18
- let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
19
- let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
2
+ const require_command_entry = require('../command-entry-iZ5O5Iza.cjs');
20
3
 
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
- update: ["executeUpdate"]
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 executeUpdate(); `,
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(", ")} ]
146
- });
147
- if (isCancel(value)) {
148
- return;
149
- }
150
-
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`
163
- const value = await text({
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) {
167
- if (!val || val.trim() === "") {
168
- return "A value must be provided for this option";
169
- }
170
-
171
- return null;
172
- }
173
- });
174
- if (isCancel(value)) {
175
- return;
176
- }
177
-
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`
188
- const value = await numeric({
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
- ` : ""}
192
- });
193
- if (isCancel(value)) {
194
- return;
195
- }
196
-
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`
207
- const value = await toggle({
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
- ` : ""}
211
- });
212
- if (isCancel(value)) {
213
- return;
214
- }
215
-
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`
236
- const value = await text({
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) {
240
- if (!val || val.trim() === "") {
241
- return "A value must be provided for this option";
242
- }
243
- if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
244
- return "At least one value must be provided for this option";
245
- }
246
- ${option.type === "number" ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
247
- if (invalidIndex !== -1) {
248
- return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
249
- } ` : ""}
250
- return undefined;
251
- }
252
- });
253
- if (isCancel(value)) {
254
- return;
255
- }
256
-
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(", ")} ]
291
- });
292
- if (isCancel(value)) {
293
- return;
294
- }
295
-
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`
308
- const value = await text({
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) {
312
- if (!val || val.trim() === "") {
313
- return "A value must be provided for this argument";
314
- }
315
-
316
- return null;
317
- }
318
- });
319
- if (isCancel(value)) {
320
- return;
321
- }
322
-
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`
333
- const value = await numeric({
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
- ` : ""}
337
- });
338
- if (isCancel(value)) {
339
- return;
340
- }
341
-
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`
352
- const value = await toggle({
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
- ` : ""}
356
- });
357
- if (isCancel(value)) {
358
- return;
359
- }
360
-
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`
381
- const value = await text({
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) {
385
- if (!val || val.trim() === "") {
386
- return "A value must be provided for this argument";
387
- }
388
- if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
389
- return "At least one value must be provided for this argument";
390
- }
391
- ${arg.type === "number" ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
392
- if (invalidIndex !== -1) {
393
- return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
394
- } ` : ""}
395
-
396
- return undefined;
397
- }
398
- });
399
- if (isCancel(value)) {
400
- return;
401
- }
402
-
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;
4
+ exports.CommandEntry = require_command_entry.CommandEntry;
@@ -1,6 +1,5 @@
1
1
  import { CommandTree } from "@shell-shock/core";
2
- import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
3
-
2
+ import { EntryFileProps } from "@shell-shock/core/contexts/power-plant";
4
3
  //#region src/components/command-entry.d.ts
5
4
  interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
6
5
  command: CommandTree;
@@ -1 +1 @@
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
+ {"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"mappings":";;;UA+CiB,0BAA0B,KACzC;EAGA,SAAS;;;;;iBAMK,aAAa,OAAO,6CAAiB"}
@@ -1,6 +1,5 @@
1
- import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
1
+ import { EntryFileProps } from "@shell-shock/core/contexts/power-plant";
2
2
  import { CommandTree } from "@shell-shock/core";
3
-
4
3
  //#region src/components/command-entry.d.ts
5
4
  interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
6
5
  command: CommandTree;