@shell-shock/preset-cli 0.2.0 → 0.3.1
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 +160 -142
- 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 +162 -144
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +85 -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 +84 -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.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/index.cjs +22 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +22 -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_core0 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_core0.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";
|
|
@@ -13,6 +13,7 @@ let __stryke_path_find = require("@stryke/path/find");
|
|
|
13
13
|
let __stryke_path_join = require("@stryke/path/join");
|
|
14
14
|
let __stryke_path_replace = require("@stryke/path/replace");
|
|
15
15
|
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
16
|
+
let __stryke_string_format_lower_case_first = require("@stryke/string-format/lower-case-first");
|
|
16
17
|
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
17
18
|
let defu = require("defu");
|
|
18
19
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
@@ -47,7 +48,6 @@ function CommandEntry(props) {
|
|
|
47
48
|
return (0, defu.default)(builtinImports ?? {}, {
|
|
48
49
|
env: [
|
|
49
50
|
"env",
|
|
50
|
-
"isCI",
|
|
51
51
|
"isDevelopment",
|
|
52
52
|
"isDebug"
|
|
53
53
|
],
|
|
@@ -62,15 +62,19 @@ function CommandEntry(props) {
|
|
|
62
62
|
"splitText",
|
|
63
63
|
"text",
|
|
64
64
|
"confirm",
|
|
65
|
-
"isCancel"
|
|
65
|
+
"isCancel",
|
|
66
|
+
"intro",
|
|
67
|
+
"outro"
|
|
66
68
|
],
|
|
67
69
|
utils: [
|
|
68
|
-
"
|
|
70
|
+
"useApp",
|
|
71
|
+
"useArgs",
|
|
69
72
|
"hasFlag",
|
|
70
73
|
"isMinimal",
|
|
71
74
|
"isInteractive",
|
|
75
|
+
"isHelp",
|
|
72
76
|
"isUnicodeSupported",
|
|
73
|
-
"
|
|
77
|
+
"internal_commandContext"
|
|
74
78
|
]
|
|
75
79
|
});
|
|
76
80
|
},
|
|
@@ -87,41 +91,49 @@ function CommandEntry(props) {
|
|
|
87
91
|
get children() {
|
|
88
92
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandValidationLogic, { command });
|
|
89
93
|
}
|
|
90
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.
|
|
91
|
-
|
|
92
|
-
(0,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
95
|
+
get condition() {
|
|
96
|
+
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(" || ")}) `;
|
|
97
|
+
},
|
|
98
|
+
get children() {
|
|
99
|
+
return [
|
|
100
|
+
__alloy_js_core.code`writeLine("");
|
|
101
|
+
|
|
102
|
+
intro("Select required input parameters"); `,
|
|
103
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
104
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
105
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
106
|
+
get each() {
|
|
107
|
+
return Object.values(command.options ?? {});
|
|
101
108
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
109
|
+
doubleHardline: true,
|
|
110
|
+
children: (option) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
111
|
+
get when() {
|
|
112
|
+
return !option.optional;
|
|
113
|
+
},
|
|
114
|
+
get children() {
|
|
115
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
116
|
+
get condition() {
|
|
117
|
+
return __alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}`;
|
|
118
|
+
},
|
|
119
|
+
get children() {
|
|
120
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Switch, { get children() {
|
|
121
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
122
|
+
get when() {
|
|
123
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
124
|
+
},
|
|
125
|
+
get children() {
|
|
126
|
+
return __alloy_js_core.code`
|
|
115
127
|
const value = await text({
|
|
116
|
-
message: 'Please provide a value for the ${option.
|
|
117
|
-
validate(
|
|
118
|
-
if (isCancel(
|
|
128
|
+
message: 'Please provide a${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} value for the "${option.name}" option${option.description ? ` (${(0, __stryke_string_format_lower_case_first.lowerCaseFirst)(option.description).replace(/\.+$/, "")})` : ""}:',
|
|
129
|
+
validate(val) {
|
|
130
|
+
if (isCancel(val)) {
|
|
119
131
|
return true;
|
|
120
132
|
}
|
|
121
|
-
if (!
|
|
122
|
-
return "A value
|
|
133
|
+
if (!val || val.trim() === "") {
|
|
134
|
+
return "A value must be provided for this option";
|
|
123
135
|
}
|
|
124
|
-
${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `if (Number.isNaN(Number(
|
|
136
|
+
${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `if (Number.isNaN(Number(val))) {
|
|
125
137
|
return "The value provided must be a valid number";
|
|
126
138
|
}` : ""}
|
|
127
139
|
return undefined;
|
|
@@ -133,45 +145,45 @@ function CommandEntry(props) {
|
|
|
133
145
|
|
|
134
146
|
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"};
|
|
135
147
|
`;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
148
|
+
}
|
|
149
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
150
|
+
get when() {
|
|
151
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean;
|
|
152
|
+
},
|
|
153
|
+
get children() {
|
|
154
|
+
return __alloy_js_core.code`
|
|
143
155
|
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = await confirm({
|
|
144
|
-
message: 'Please select a value for the ${option.
|
|
156
|
+
message: 'Please select a value for the "${option.name}" option${option.description ? ` (${(0, __stryke_string_format_lower_case_first.lowerCaseFirst)(option.description).replace(/\.+$/, "")})` : ""}:'
|
|
145
157
|
});
|
|
146
158
|
`;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
}
|
|
160
|
+
})];
|
|
161
|
+
} });
|
|
162
|
+
}
|
|
163
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
164
|
+
get when() {
|
|
165
|
+
return (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && option.variadic;
|
|
166
|
+
},
|
|
167
|
+
get children() {
|
|
168
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
169
|
+
get condition() {
|
|
170
|
+
return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
|
|
171
|
+
},
|
|
172
|
+
get children() {
|
|
173
|
+
return __alloy_js_core.code`
|
|
162
174
|
const value = await text({
|
|
163
|
-
message: 'Please provide one or more values for the ${option.
|
|
164
|
-
validate(
|
|
165
|
-
if (isCancel(
|
|
175
|
+
message: 'Please provide one or more${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} values for the "${option.name}" option${option.description ? ` (${(0, __stryke_string_format_lower_case_first.lowerCaseFirst)(option.description).replace(/\.+$/, "")})` : ""} - values are separated by a "," character:',
|
|
176
|
+
validate(val) {
|
|
177
|
+
if (isCancel(val)) {
|
|
166
178
|
return true;
|
|
167
179
|
}
|
|
168
|
-
if (!
|
|
169
|
-
return "A value
|
|
180
|
+
if (!val || val.trim() === "") {
|
|
181
|
+
return "A value must be provided for this option";
|
|
170
182
|
}
|
|
171
|
-
if (
|
|
172
|
-
return "At least one value
|
|
183
|
+
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
184
|
+
return "At least one value must be provided for this option";
|
|
173
185
|
}
|
|
174
|
-
${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `const invalidIndex =
|
|
186
|
+
${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
|
|
175
187
|
if (invalidIndex !== -1) {
|
|
176
188
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
177
189
|
} ` : ""}
|
|
@@ -184,48 +196,48 @@ function CommandEntry(props) {
|
|
|
184
196
|
|
|
185
197
|
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)` : ""} ;
|
|
186
198
|
`;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
},
|
|
200
|
-
doubleHardline: true,
|
|
201
|
-
children: (argument) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
202
|
-
get when() {
|
|
203
|
-
return !argument.optional;
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
})];
|
|
203
|
+
}
|
|
204
|
+
})]
|
|
205
|
+
}),
|
|
206
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
207
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
208
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
209
|
+
get each() {
|
|
210
|
+
return command.arguments;
|
|
204
211
|
},
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
212
|
+
doubleHardline: true,
|
|
213
|
+
children: (argument) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
214
|
+
get when() {
|
|
215
|
+
return !argument.optional;
|
|
216
|
+
},
|
|
217
|
+
get children() {
|
|
218
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
219
|
+
get condition() {
|
|
220
|
+
return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}`;
|
|
221
|
+
},
|
|
222
|
+
get children() {
|
|
223
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Switch, { get children() {
|
|
224
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
225
|
+
get when() {
|
|
226
|
+
return argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
227
|
+
},
|
|
228
|
+
get children() {
|
|
229
|
+
return __alloy_js_core.code`
|
|
218
230
|
const value = await text({
|
|
219
|
-
message: 'Please provide a value for the ${argument.
|
|
220
|
-
validate(
|
|
221
|
-
if (isCancel(
|
|
231
|
+
message: 'Please provide a${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} value for the "${argument.name}" argument${argument.description ? ` (${(0, __stryke_string_format_lower_case_first.lowerCaseFirst)(argument.description).replace(/\.+$/, "")})` : ""}:',
|
|
232
|
+
validate(val) {
|
|
233
|
+
if (isCancel(val)) {
|
|
222
234
|
return true;
|
|
223
235
|
}
|
|
224
|
-
if (!
|
|
225
|
-
return "A value
|
|
236
|
+
if (!val || val.trim() === "") {
|
|
237
|
+
return "A value must be provided for this argument";
|
|
226
238
|
}
|
|
227
|
-
${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `if (Number.isNaN(Number(
|
|
228
|
-
return "The value
|
|
239
|
+
${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `if (Number.isNaN(Number(val))) {
|
|
240
|
+
return "The provided value must be a valid number";
|
|
229
241
|
}` : ""}
|
|
230
242
|
return undefined;
|
|
231
243
|
}
|
|
@@ -236,45 +248,45 @@ function CommandEntry(props) {
|
|
|
236
248
|
|
|
237
249
|
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = ${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `Number(value)` : "value"};
|
|
238
250
|
`;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
251
|
+
}
|
|
252
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
253
|
+
get when() {
|
|
254
|
+
return argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean;
|
|
255
|
+
},
|
|
256
|
+
get children() {
|
|
257
|
+
return __alloy_js_core.code`
|
|
246
258
|
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = await confirm({
|
|
247
|
-
message: 'Please select a value for the ${argument.
|
|
259
|
+
message: 'Please select a value for the "${argument.name}" argument${argument.description ? ` (${(0, __stryke_string_format_lower_case_first.lowerCaseFirst)(argument.description).replace(/\.+$/, "")})` : ""}:'
|
|
248
260
|
});
|
|
249
261
|
`;
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
}
|
|
263
|
+
})];
|
|
264
|
+
} });
|
|
265
|
+
}
|
|
266
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
267
|
+
get when() {
|
|
268
|
+
return (argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && argument.variadic;
|
|
269
|
+
},
|
|
270
|
+
get children() {
|
|
271
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
272
|
+
get condition() {
|
|
273
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0`;
|
|
274
|
+
},
|
|
275
|
+
get children() {
|
|
276
|
+
return __alloy_js_core.code`
|
|
265
277
|
const value = await text({
|
|
266
|
-
message: 'Please provide one or more values for the ${argument.
|
|
267
|
-
validate(
|
|
268
|
-
if (isCancel(
|
|
278
|
+
message: 'Please provide one or more${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} values for the "${argument.name}" argument${argument.description ? ` (${(0, __stryke_string_format_lower_case_first.lowerCaseFirst)(argument.description).replace(/\.+$/, "")})` : ""} - values are separated by a "," character:',
|
|
279
|
+
validate(val) {
|
|
280
|
+
if (isCancel(val)) {
|
|
269
281
|
return true;
|
|
270
282
|
}
|
|
271
|
-
if (!
|
|
272
|
-
return "A value
|
|
283
|
+
if (!val || val.trim() === "") {
|
|
284
|
+
return "A value must be provided for this argument";
|
|
273
285
|
}
|
|
274
|
-
if (
|
|
275
|
-
return "At least one value
|
|
286
|
+
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
287
|
+
return "At least one value must be provided for this argument";
|
|
276
288
|
}
|
|
277
|
-
${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `const invalidIndex =
|
|
289
|
+
${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
|
|
278
290
|
if (invalidIndex !== -1) {
|
|
279
291
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
280
292
|
} ` : ""}
|
|
@@ -288,15 +300,21 @@ function CommandEntry(props) {
|
|
|
288
300
|
|
|
289
301
|
${(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)` : ""} ;
|
|
290
302
|
`;
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
})];
|
|
307
|
+
}
|
|
308
|
+
})]
|
|
309
|
+
}),
|
|
310
|
+
__alloy_js_core.code`outro("Completed providing all required input parameters");
|
|
311
|
+
|
|
312
|
+
writeLine(""); `,
|
|
313
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
314
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
315
|
+
];
|
|
316
|
+
}
|
|
317
|
+
})];
|
|
300
318
|
}
|
|
301
319
|
})
|
|
302
320
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core1 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_core1.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":";;;;;UAyCiB,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":";;;;;UAyCiB,iBAAA,SAA0B,KACzC;WAGS;;AAJX;;;AAA2C,iBAU3B,YAAA,CAV2B,KAAA,EAUP,iBAVO,CAAA,EAUU,eAAA,CAAA,QAVV"}
|