@shell-shock/preset-cli 0.1.6 → 0.3.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/README.md +1 -1
- package/dist/components/banner-function-declaration.d.cts +2 -2
- package/dist/components/banner-function-declaration.d.mts +2 -2
- package/dist/components/banner-function-declaration.mjs +1 -1
- package/dist/components/command-entry.cjs +221 -129
- 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 +225 -133
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +87 -0
- package/dist/components/command-router.d.cts +16 -0
- package/dist/components/command-router.d.cts.map +1 -0
- package/dist/components/command-router.d.mts +16 -0
- package/dist/components/command-router.d.mts.map +1 -0
- package/dist/components/command-router.mjs +86 -0
- package/dist/components/command-router.mjs.map +1 -0
- package/dist/components/virtual-command-entry.cjs +28 -4
- package/dist/components/virtual-command-entry.d.cts +2 -2
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +28 -4
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +1 -1
- package/dist/helpers/get-default-options.mjs +1 -1
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +37 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +37 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -8
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the ⚡<b>Shell Shock</b> monorepo. The Shell Shock pack
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://stormsoftware.com/projects/shell-shock/) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core3 from "@alloy-js/core";
|
|
2
2
|
import { BannerFunctionDeclarationProps } from "@shell-shock/preset-script/components/banner-function-declaration";
|
|
3
3
|
|
|
4
4
|
//#region src/components/banner-function-declaration.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
7
7
|
*/
|
|
8
|
-
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps):
|
|
8
|
+
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core3.Children;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { BannerFunctionDeclaration };
|
|
11
11
|
//# sourceMappingURL=banner-function-declaration.d.cts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core2 from "@alloy-js/core";
|
|
2
2
|
import { BannerFunctionDeclarationProps } from "@shell-shock/preset-script/components/banner-function-declaration";
|
|
3
3
|
|
|
4
4
|
//#region src/components/banner-function-declaration.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
7
7
|
*/
|
|
8
|
-
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps):
|
|
8
|
+
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core2.Children;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { BannerFunctionDeclaration };
|
|
11
11
|
//# sourceMappingURL=banner-function-declaration.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
1
|
+
import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { code, computed } from "@alloy-js/core";
|
|
3
3
|
import { FunctionDeclaration } from "@alloy-js/typescript";
|
|
4
4
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
@@ -38,13 +38,15 @@ function CommandEntry(props) {
|
|
|
38
38
|
return typeDefinition.value;
|
|
39
39
|
},
|
|
40
40
|
get imports() {
|
|
41
|
-
return (0, defu.default)(imports ?? {}, {
|
|
41
|
+
return (0, defu.default)(imports ?? {}, {
|
|
42
|
+
[commandSourcePath.value]: `handle${(0, __stryke_string_format_pascal_case.pascalCase)(command.name)}`,
|
|
43
|
+
prompts: "prompts"
|
|
44
|
+
});
|
|
42
45
|
},
|
|
43
46
|
get builtinImports() {
|
|
44
47
|
return (0, defu.default)(builtinImports ?? {}, {
|
|
45
48
|
env: [
|
|
46
49
|
"env",
|
|
47
|
-
"isCI",
|
|
48
50
|
"isDevelopment",
|
|
49
51
|
"isDebug"
|
|
50
52
|
],
|
|
@@ -56,12 +58,20 @@ function CommandEntry(props) {
|
|
|
56
58
|
"colors",
|
|
57
59
|
"stripAnsi",
|
|
58
60
|
"writeLine",
|
|
59
|
-
"splitText"
|
|
61
|
+
"splitText",
|
|
62
|
+
"text",
|
|
63
|
+
"confirm",
|
|
64
|
+
"isCancel",
|
|
65
|
+
"intro",
|
|
66
|
+
"outro"
|
|
60
67
|
],
|
|
61
68
|
utils: [
|
|
62
|
-
"
|
|
69
|
+
"useApp",
|
|
70
|
+
"useArgs",
|
|
63
71
|
"hasFlag",
|
|
64
72
|
"isMinimal",
|
|
73
|
+
"isInteractive",
|
|
74
|
+
"isHelp",
|
|
65
75
|
"isUnicodeSupported",
|
|
66
76
|
"internal_commandContext"
|
|
67
77
|
]
|
|
@@ -75,153 +85,235 @@ function CommandEntry(props) {
|
|
|
75
85
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandHandlerDeclaration, {
|
|
76
86
|
command,
|
|
77
87
|
get children() {
|
|
78
|
-
return [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return __alloy_js_core.code`failures.push("Missing required \\"${option.name}\\" option");`;
|
|
101
|
-
}
|
|
102
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
88
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
89
|
+
condition: __alloy_js_core.code`!isInteractive`,
|
|
90
|
+
get children() {
|
|
91
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandValidationLogic, { command });
|
|
92
|
+
}
|
|
93
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
94
|
+
get condition() {
|
|
95
|
+
return __alloy_js_core.code`!isHelp && (${Object.values(command.options ?? {}).filter((option) => !option.optional).map((option) => (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.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.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 === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && argument.variadic ? `(!${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} || ${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0)` : `${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} === undefined`).join(" || ")}) `;
|
|
96
|
+
},
|
|
97
|
+
get children() {
|
|
98
|
+
return [
|
|
99
|
+
__alloy_js_core.code`writeLine("");
|
|
100
|
+
|
|
101
|
+
intro("Select required input parameters"); `,
|
|
102
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
103
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
104
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
105
|
+
get each() {
|
|
106
|
+
return Object.values(command.options ?? {});
|
|
107
|
+
},
|
|
108
|
+
doubleHardline: true,
|
|
109
|
+
children: (option) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
103
110
|
get when() {
|
|
104
|
-
return
|
|
111
|
+
return !option.optional;
|
|
105
112
|
},
|
|
106
113
|
get children() {
|
|
107
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.
|
|
114
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
108
115
|
get condition() {
|
|
109
|
-
return __alloy_js_core.code
|
|
116
|
+
return __alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}`;
|
|
110
117
|
},
|
|
111
118
|
get children() {
|
|
112
|
-
return __alloy_js_core.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
119
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Switch, { get children() {
|
|
120
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
121
|
+
get when() {
|
|
122
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
123
|
+
},
|
|
124
|
+
get children() {
|
|
125
|
+
return __alloy_js_core.code`
|
|
126
|
+
const value = await text({
|
|
127
|
+
message: 'Please provide a value for the ${option.title} option:',
|
|
128
|
+
validate(value) {
|
|
129
|
+
if (isCancel(value)) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
if (!value || value.trim() === "") {
|
|
133
|
+
return "A value is required for this option";
|
|
134
|
+
}
|
|
135
|
+
${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `if (Number.isNaN(Number(value))) {
|
|
136
|
+
return "The value provided must be a valid number";
|
|
137
|
+
}` : ""}
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
if (isCancel(value)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = ${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `Number(value)` : "value"};
|
|
146
|
+
`;
|
|
147
|
+
}
|
|
148
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
149
|
+
get when() {
|
|
150
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean;
|
|
151
|
+
},
|
|
152
|
+
get children() {
|
|
153
|
+
return __alloy_js_core.code`
|
|
154
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = await confirm({
|
|
155
|
+
message: 'Please select a value for the ${option.title} option:'
|
|
156
|
+
});
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
})];
|
|
160
|
+
} });
|
|
134
161
|
}
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
139
|
-
get condition() {
|
|
140
|
-
return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.some(value => Number.isNaN(value))`;
|
|
162
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
163
|
+
get when() {
|
|
164
|
+
return (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && option.variadic;
|
|
141
165
|
},
|
|
142
166
|
get children() {
|
|
143
|
-
return
|
|
167
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
168
|
+
get condition() {
|
|
169
|
+
return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
|
|
170
|
+
},
|
|
171
|
+
get children() {
|
|
172
|
+
return __alloy_js_core.code`
|
|
173
|
+
const value = await text({
|
|
174
|
+
message: 'Please provide one or more values for the ${option.title} option (values are separated by a "," character):',
|
|
175
|
+
validate(value) {
|
|
176
|
+
if (isCancel(value)) {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
if (!value || value.trim() === "") {
|
|
180
|
+
return "A value is required for this option";
|
|
181
|
+
}
|
|
182
|
+
if (value.split(",").map(value => value.trim()).filter(Boolean).length === 0) {
|
|
183
|
+
return "At least one value is required for this option";
|
|
184
|
+
}
|
|
185
|
+
${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `const invalidIndex = value.split(",").map(value => value.trim()).filter(Boolean).findIndex(value => Number.isNaN(Number(value));
|
|
186
|
+
if (invalidIndex !== -1) {
|
|
187
|
+
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
188
|
+
} ` : ""}
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
if (isCancel(value)) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = value.split(",").map(value => value.trim()).filter(Boolean)${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `.map(Number)` : ""} ;
|
|
197
|
+
`;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
144
200
|
}
|
|
145
|
-
});
|
|
201
|
+
})];
|
|
146
202
|
}
|
|
147
|
-
})
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
doubleHardline: true,
|
|
158
|
-
children: (argument) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
159
|
-
get when() {
|
|
160
|
-
return !argument.optional;
|
|
161
|
-
},
|
|
162
|
-
get children() {
|
|
163
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
164
|
-
get condition() {
|
|
165
|
-
return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}`;
|
|
166
|
-
},
|
|
167
|
-
get children() {
|
|
168
|
-
return __alloy_js_core.code`failures.push("Missing required \\"${argument.name}\\" positional argument");`;
|
|
169
|
-
}
|
|
170
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
203
|
+
})]
|
|
204
|
+
}),
|
|
205
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
206
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
207
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
208
|
+
get each() {
|
|
209
|
+
return command.arguments;
|
|
210
|
+
},
|
|
211
|
+
doubleHardline: true,
|
|
212
|
+
children: (argument) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
171
213
|
get when() {
|
|
172
|
-
return
|
|
214
|
+
return !argument.optional;
|
|
173
215
|
},
|
|
174
216
|
get children() {
|
|
175
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.
|
|
217
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
176
218
|
get condition() {
|
|
177
|
-
return __alloy_js_core.code
|
|
219
|
+
return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}`;
|
|
178
220
|
},
|
|
179
221
|
get children() {
|
|
180
|
-
return __alloy_js_core.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
222
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Switch, { get children() {
|
|
223
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
224
|
+
get when() {
|
|
225
|
+
return argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
226
|
+
},
|
|
227
|
+
get children() {
|
|
228
|
+
return __alloy_js_core.code`
|
|
229
|
+
const value = await text({
|
|
230
|
+
message: 'Please provide a value for the ${argument.title} positional argument:',
|
|
231
|
+
validate(value) {
|
|
232
|
+
if (isCancel(value)) {
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
if (!value || value.trim() === "") {
|
|
236
|
+
return "A value is required for this positional argument";
|
|
237
|
+
}
|
|
238
|
+
${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `if (Number.isNaN(Number(value))) {
|
|
239
|
+
return "The value provided must be a valid number";
|
|
240
|
+
}` : ""}
|
|
241
|
+
return undefined;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
if (isCancel(value)) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = ${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `Number(value)` : "value"};
|
|
249
|
+
`;
|
|
250
|
+
}
|
|
251
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
252
|
+
get when() {
|
|
253
|
+
return argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean;
|
|
254
|
+
},
|
|
255
|
+
get children() {
|
|
256
|
+
return __alloy_js_core.code`
|
|
257
|
+
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = await confirm({
|
|
258
|
+
message: 'Please select a value for the ${argument.title} positional argument:'
|
|
259
|
+
});
|
|
260
|
+
`;
|
|
261
|
+
}
|
|
262
|
+
})];
|
|
263
|
+
} });
|
|
202
264
|
}
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
207
|
-
get condition() {
|
|
208
|
-
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.some(value => Number.isNaN(value))`;
|
|
265
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
266
|
+
get when() {
|
|
267
|
+
return (argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && argument.variadic;
|
|
209
268
|
},
|
|
210
269
|
get children() {
|
|
211
|
-
return
|
|
270
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
271
|
+
get condition() {
|
|
272
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0`;
|
|
273
|
+
},
|
|
274
|
+
get children() {
|
|
275
|
+
return __alloy_js_core.code`
|
|
276
|
+
const value = await text({
|
|
277
|
+
message: 'Please provide one or more values for the ${argument.title} option (values are separated by a "," character):',
|
|
278
|
+
validate(value) {
|
|
279
|
+
if (isCancel(value)) {
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
if (!value || value.trim() === "") {
|
|
283
|
+
return "A value is required for this option";
|
|
284
|
+
}
|
|
285
|
+
if (value.split(",").map(value => value.trim()).filter(Boolean).length === 0) {
|
|
286
|
+
return "At least one value is required for this option";
|
|
287
|
+
}
|
|
288
|
+
${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `const invalidIndex = value.split(",").map(value => value.trim()).filter(Boolean).findIndex(value => Number.isNaN(Number(value));
|
|
289
|
+
if (invalidIndex !== -1) {
|
|
290
|
+
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
291
|
+
} ` : ""}
|
|
292
|
+
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
if (isCancel(value)) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = value.split(",").map(value => value.trim()).filter(Boolean)${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `.map(Number)` : ""} ;
|
|
301
|
+
`;
|
|
302
|
+
}
|
|
303
|
+
});
|
|
212
304
|
}
|
|
213
|
-
});
|
|
305
|
+
})];
|
|
214
306
|
}
|
|
215
|
-
})
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
];
|
|
307
|
+
})]
|
|
308
|
+
}),
|
|
309
|
+
__alloy_js_core.code`outro("Completed providing all required input parameters");
|
|
310
|
+
|
|
311
|
+
writeLine(""); `,
|
|
312
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
313
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
314
|
+
];
|
|
315
|
+
}
|
|
316
|
+
})];
|
|
225
317
|
}
|
|
226
318
|
})
|
|
227
319
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core2 from "@alloy-js/core";
|
|
2
2
|
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
|
|
|
9
9
|
/**
|
|
10
10
|
* The command entry point for the Shell Shock project.
|
|
11
11
|
*/
|
|
12
|
-
declare function CommandEntry(props: CommandEntryProps):
|
|
12
|
+
declare function CommandEntry(props: CommandEntryProps): _alloy_js_core2.Children;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { CommandEntry, CommandEntryProps };
|
|
15
15
|
//# sourceMappingURL=command-entry.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAwCiB,iBAAA,SAA0B,KACzC;WAGS;;AAJX;;;AAA2C,iBAU3B,YAAA,CAV2B,KAAA,EAUP,iBAVO,CAAA,EAUU,eAAA,CAAA,QAVV"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core3 from "@alloy-js/core";
|
|
2
2
|
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
|
|
|
9
9
|
/**
|
|
10
10
|
* The command entry point for the Shell Shock project.
|
|
11
11
|
*/
|
|
12
|
-
declare function CommandEntry(props: CommandEntryProps):
|
|
12
|
+
declare function CommandEntry(props: CommandEntryProps): _alloy_js_core3.Children;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { CommandEntry, CommandEntryProps };
|
|
15
15
|
//# sourceMappingURL=command-entry.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAwCiB,iBAAA,SAA0B,KACzC;WAGS;;AAJX;;;AAA2C,iBAU3B,YAAA,CAV2B,KAAA,EAUP,iBAVO,CAAA,EAUU,eAAA,CAAA,QAVV"}
|