@shell-shock/core 0.17.5 → 0.17.7
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/command-validation-logic.cjs +214 -152
- package/dist/components/command-validation-logic.mjs +213 -152
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +113 -9
- package/dist/components/docs.mjs +109 -9
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/exec-builtin.cjs +36 -1
- package/dist/components/exec-builtin.d.cts.map +1 -1
- package/dist/components/exec-builtin.d.mts.map +1 -1
- package/dist/components/exec-builtin.mjs +35 -1
- package/dist/components/exec-builtin.mjs.map +1 -1
- package/dist/components/helpers.cjs +51 -2
- package/dist/components/helpers.mjs +50 -2
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/index.cjs +17 -1
- package/dist/components/index.mjs +9 -9
- package/dist/components/options-parser-logic.cjs +411 -174
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +405 -174
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/state-builtin.cjs +61 -5
- package/dist/components/state-builtin.mjs +60 -5
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/usage.cjs +46 -3
- package/dist/components/usage.mjs +45 -3
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +68 -3
- package/dist/components/utils-builtin.mjs +67 -3
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/helpers/automd.cjs +28 -13
- package/dist/helpers/automd.mjs +28 -13
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/index.cjs +11 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/plugin-utils/compute-bin.cjs +50 -0
- package/dist/plugin-utils/compute-bin.d.cts +13 -0
- package/dist/plugin-utils/compute-bin.d.cts.map +1 -0
- package/dist/plugin-utils/compute-bin.d.mts +13 -0
- package/dist/plugin-utils/compute-bin.d.mts.map +1 -0
- package/dist/plugin-utils/compute-bin.mjs +50 -0
- package/dist/plugin-utils/compute-bin.mjs.map +1 -0
- package/dist/plugin-utils/get-command-tree.cjs +50 -0
- package/dist/plugin-utils/get-command-tree.d.cts +15 -1
- package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.mts +15 -1
- package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/get-command-tree.mjs +49 -1
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +4 -0
- package/dist/plugin-utils/index.d.cts +3 -2
- package/dist/plugin-utils/index.d.mts +3 -2
- package/dist/plugin-utils/index.mjs +3 -2
- package/dist/plugin.cjs +170 -52
- package/dist/plugin.mjs +170 -52
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +1 -1
- package/dist/resolver/deepkit.mjs +1 -1
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/dist/types/command.cjs +120 -10
- package/dist/types/command.d.cts +95 -8
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts +95 -8
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs +109 -10
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/index.cjs +12 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +2 -2
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -249,7 +249,7 @@ generation of development tools, please reach out on our
|
|
|
249
249
|
|
|
250
250
|
<div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://public.storm-cdn.com/storm-software/icon-circle-fill-dark.png" alt="Storm Software" width="200px"/></a></div>
|
|
251
251
|
<br />
|
|
252
|
-
<div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://public.storm-cdn.com/visit-us-
|
|
252
|
+
<div align="center"><a href="https://stormsoftware.com" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/misc/text/visit-us-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/misc/text/visit-us-light.png"><img src="https://public.storm-cdn.com/misc/text/visit-us-dark.png" height="90px" alt="Visit us at stormsoftware.com" /></picture></a></div>
|
|
253
253
|
|
|
254
254
|
<br />
|
|
255
255
|
|
|
@@ -9,6 +9,16 @@ let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
|
9
9
|
let _stryke_string_format_list = require("@stryke/string-format/list");
|
|
10
10
|
|
|
11
11
|
//#region src/components/command-validation-logic.tsx
|
|
12
|
+
function __assignType(fn, args) {
|
|
13
|
+
fn.__type = args;
|
|
14
|
+
return fn;
|
|
15
|
+
}
|
|
16
|
+
const __ΩCommandValidationLogicProps = [
|
|
17
|
+
"CommandTree",
|
|
18
|
+
"command",
|
|
19
|
+
"CommandValidationLogicProps",
|
|
20
|
+
"P\"w!4\"Mw#y"
|
|
21
|
+
];
|
|
12
22
|
/**
|
|
13
23
|
* A component that generates command validation logic for required options and arguments.
|
|
14
24
|
*/
|
|
@@ -26,205 +36,257 @@ function CommandValidationLogic(props) {
|
|
|
26
36
|
return Object.values(command.options ?? {});
|
|
27
37
|
},
|
|
28
38
|
doubleHardline: true,
|
|
29
|
-
children
|
|
30
|
-
(
|
|
39
|
+
get children() {
|
|
40
|
+
return __assignType((option) => [
|
|
41
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
42
|
+
get when() {
|
|
43
|
+
return !option.optional;
|
|
44
|
+
},
|
|
45
|
+
get children() {
|
|
46
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
47
|
+
get condition() {
|
|
48
|
+
return _alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}`;
|
|
49
|
+
},
|
|
50
|
+
get children() {
|
|
51
|
+
return _alloy_js_core.code`failures.push("Missing required \\"${option.name}\\" option");`;
|
|
52
|
+
}
|
|
53
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
54
|
+
get when() {
|
|
55
|
+
return option.variadic;
|
|
56
|
+
},
|
|
57
|
+
get children() {
|
|
58
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
59
|
+
get condition() {
|
|
60
|
+
return _alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
|
|
61
|
+
},
|
|
62
|
+
get children() {
|
|
63
|
+
return _alloy_js_core.code`failures.push("No values were provided to the required \\"${option.name}\\" array option");`;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
})];
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
71
|
+
get when() {
|
|
72
|
+
return option.kind === require_types_command.CommandParameterKinds.number;
|
|
73
|
+
},
|
|
74
|
+
get children() {
|
|
75
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
76
|
+
get when() {
|
|
77
|
+
return option.variadic;
|
|
78
|
+
},
|
|
79
|
+
get fallback() {
|
|
80
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
81
|
+
get condition() {
|
|
82
|
+
return _alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} && Number.isNaN(options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`})`;
|
|
83
|
+
},
|
|
84
|
+
get children() {
|
|
85
|
+
return _alloy_js_core.code`failures.push("Invalid numeric value provided for the \\"${option.name}\\" option");`;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
get children() {
|
|
90
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
91
|
+
get condition() {
|
|
92
|
+
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))`;
|
|
93
|
+
},
|
|
94
|
+
get children() {
|
|
95
|
+
return _alloy_js_core.code`failures.push("Invalid numeric value provided in the \\"${option.name}\\" array option");`;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}),
|
|
102
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
103
|
+
get when() {
|
|
104
|
+
return (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.choices && option.choices.length > 0;
|
|
105
|
+
},
|
|
106
|
+
get children() {
|
|
107
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
108
|
+
get when() {
|
|
109
|
+
return !option.variadic;
|
|
110
|
+
},
|
|
111
|
+
get fallback() {
|
|
112
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
113
|
+
get when() {
|
|
114
|
+
return !option.optional;
|
|
115
|
+
},
|
|
116
|
+
get fallback() {
|
|
117
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
118
|
+
get condition() {
|
|
119
|
+
return _alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}.every(value => [${option.choices?.map(__assignType((choice) => option.kind === require_types_command.CommandParameterKinds.string ? `"${choice}"` : choice, [
|
|
120
|
+
"choice",
|
|
121
|
+
"",
|
|
122
|
+
"P\"2!\"/\""
|
|
123
|
+
])).join(", ")}].includes(value))`;
|
|
124
|
+
},
|
|
125
|
+
get children() {
|
|
126
|
+
return _alloy_js_core.code`failures.push(\`Invalid value provided for the \\"${option.name}\\" option - valid values include: ${(0, _stryke_string_format_list.list)(option?.choices?.map(__assignType((choice) => String(choice), [
|
|
127
|
+
"choice",
|
|
128
|
+
"",
|
|
129
|
+
"P\"2!\"/\""
|
|
130
|
+
])) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}}\`);`;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
get children() {
|
|
135
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
136
|
+
get condition() {
|
|
137
|
+
return _alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}.every(value => [${option.choices?.map(__assignType((choice) => option.kind === require_types_command.CommandParameterKinds.string ? `"${choice}"` : choice, [
|
|
138
|
+
"choice",
|
|
139
|
+
"",
|
|
140
|
+
"P\"2!\"/\""
|
|
141
|
+
])).join(", ")}].includes(value))`;
|
|
142
|
+
},
|
|
143
|
+
get children() {
|
|
144
|
+
return _alloy_js_core.code`failures.push(\`Invalid value provided for the \\"${option.name}\\" option - valid values include: ${(0, _stryke_string_format_list.list)(option?.choices?.map(__assignType((choice) => String(choice), [
|
|
145
|
+
"choice",
|
|
146
|
+
"",
|
|
147
|
+
"P\"2!\"/\""
|
|
148
|
+
])) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}}\`);`;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
get children() {
|
|
155
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
156
|
+
get when() {
|
|
157
|
+
return !option.optional;
|
|
158
|
+
},
|
|
159
|
+
get fallback() {
|
|
160
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
161
|
+
get condition() {
|
|
162
|
+
return _alloy_js_core.code`![${option.choices?.map(__assignType((choice) => option.kind === require_types_command.CommandParameterKinds.string ? `"${choice}"` : choice, [
|
|
163
|
+
"choice",
|
|
164
|
+
"",
|
|
165
|
+
"P\"2!\"/\""
|
|
166
|
+
])).join(", ")}].includes(options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`})`;
|
|
167
|
+
},
|
|
168
|
+
get children() {
|
|
169
|
+
return _alloy_js_core.code`failures.push(\`Invalid value provided for the \\"${option.name}\\" option - valid values include: ${(0, _stryke_string_format_list.list)(option?.choices?.map(__assignType((choice) => String(choice), [
|
|
170
|
+
"choice",
|
|
171
|
+
"",
|
|
172
|
+
"P\"2!\"/\""
|
|
173
|
+
])) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}}\`);`;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
get children() {
|
|
178
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
179
|
+
get condition() {
|
|
180
|
+
return _alloy_js_core.code`![${option.choices?.map(__assignType((choice) => option.kind === require_types_command.CommandParameterKinds.string ? `"${choice}"` : choice, [
|
|
181
|
+
"choice",
|
|
182
|
+
"",
|
|
183
|
+
"P\"2!\"/\""
|
|
184
|
+
])).join(", ")}].includes(options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`})`;
|
|
185
|
+
},
|
|
186
|
+
get children() {
|
|
187
|
+
return _alloy_js_core.code`failures.push(\`Invalid value provided for the \\"${option.name}\\" option - valid values include: ${(0, _stryke_string_format_list.list)(option?.choices?.map(__assignType((choice) => String(choice), [
|
|
188
|
+
"choice",
|
|
189
|
+
"",
|
|
190
|
+
"P\"2!\"/\""
|
|
191
|
+
])) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}}\`);`;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
], [
|
|
201
|
+
"option",
|
|
202
|
+
"",
|
|
203
|
+
"P\"2!\"/\""
|
|
204
|
+
]);
|
|
205
|
+
}
|
|
206
|
+
}),
|
|
207
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
208
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
209
|
+
get each() {
|
|
210
|
+
return command.args;
|
|
211
|
+
},
|
|
212
|
+
doubleHardline: true,
|
|
213
|
+
get children() {
|
|
214
|
+
return __assignType((argument) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
31
215
|
get when() {
|
|
32
|
-
return !
|
|
216
|
+
return !argument.optional;
|
|
33
217
|
},
|
|
34
218
|
get children() {
|
|
35
219
|
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
36
220
|
get condition() {
|
|
37
|
-
return _alloy_js_core.code
|
|
221
|
+
return _alloy_js_core.code`!${(0, _stryke_string_format_camel_case.camelCase)(argument.name)}`;
|
|
38
222
|
},
|
|
39
223
|
get children() {
|
|
40
|
-
return _alloy_js_core.code`failures.push("Missing required ${
|
|
224
|
+
return _alloy_js_core.code`failures.push("Missing required \\"${argument.name}\\" positional argument");`;
|
|
41
225
|
}
|
|
42
226
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
43
227
|
get when() {
|
|
44
|
-
return
|
|
228
|
+
return argument.variadic;
|
|
45
229
|
},
|
|
46
230
|
get children() {
|
|
47
231
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
48
232
|
get condition() {
|
|
49
|
-
return _alloy_js_core.code
|
|
233
|
+
return _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0`;
|
|
50
234
|
},
|
|
51
235
|
get children() {
|
|
52
|
-
return _alloy_js_core.code`failures.push("No values were provided to the required ${
|
|
236
|
+
return _alloy_js_core.code`failures.push("No values were provided to the required \\"${argument.name}\\" array positional argument");`;
|
|
53
237
|
}
|
|
54
238
|
});
|
|
55
239
|
}
|
|
56
240
|
})];
|
|
57
241
|
}
|
|
58
|
-
}),
|
|
59
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
242
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
60
243
|
get when() {
|
|
61
|
-
return
|
|
244
|
+
return argument.kind === require_types_command.CommandParameterKinds.number;
|
|
62
245
|
},
|
|
63
246
|
get children() {
|
|
64
247
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
65
248
|
get when() {
|
|
66
|
-
return
|
|
249
|
+
return argument.variadic;
|
|
67
250
|
},
|
|
68
251
|
get fallback() {
|
|
69
252
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
70
253
|
get condition() {
|
|
71
|
-
return _alloy_js_core.code
|
|
254
|
+
return _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(argument.name)} && Number.isNaN(${(0, _stryke_string_format_camel_case.camelCase)(argument.name)})`;
|
|
72
255
|
},
|
|
73
256
|
get children() {
|
|
74
|
-
return _alloy_js_core.code`failures.push("Invalid numeric value provided for the ${
|
|
257
|
+
return _alloy_js_core.code`failures.push("Invalid numeric value provided for the \\"${argument.name}\\" positional argument");`;
|
|
75
258
|
}
|
|
76
259
|
});
|
|
77
260
|
},
|
|
78
261
|
get children() {
|
|
79
262
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
80
263
|
get condition() {
|
|
81
|
-
return _alloy_js_core.code
|
|
264
|
+
return _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(argument.name)}.some(value => Number.isNaN(value))`;
|
|
82
265
|
},
|
|
83
266
|
get children() {
|
|
84
|
-
return _alloy_js_core.code`failures.push("Invalid numeric value provided in the ${
|
|
267
|
+
return _alloy_js_core.code`failures.push("Invalid numeric value provided in the \\"${argument.name}\\" array positional argument");`;
|
|
85
268
|
}
|
|
86
269
|
});
|
|
87
270
|
}
|
|
88
271
|
});
|
|
89
272
|
}
|
|
90
|
-
}),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
97
|
-
get when() {
|
|
98
|
-
return !option.variadic;
|
|
99
|
-
},
|
|
100
|
-
get fallback() {
|
|
101
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
102
|
-
get when() {
|
|
103
|
-
return !option.optional;
|
|
104
|
-
},
|
|
105
|
-
get fallback() {
|
|
106
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
107
|
-
get condition() {
|
|
108
|
-
return _alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}.every(value => [${option.choices?.map((choice) => option.kind === require_types_command.CommandParameterKinds.string ? `"${choice}"` : choice).join(", ")}].includes(value))`;
|
|
109
|
-
},
|
|
110
|
-
get children() {
|
|
111
|
-
return _alloy_js_core.code`failures.push(\`Invalid value provided for the ${option.name} option - valid values include: ${(0, _stryke_string_format_list.list)(option?.choices?.map((choice) => String(choice)) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}}\`);`;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
},
|
|
115
|
-
get children() {
|
|
116
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
117
|
-
get condition() {
|
|
118
|
-
return _alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}.every(value => [${option.choices?.map((choice) => option.kind === require_types_command.CommandParameterKinds.string ? `"${choice}"` : choice).join(", ")}].includes(value))`;
|
|
119
|
-
},
|
|
120
|
-
get children() {
|
|
121
|
-
return _alloy_js_core.code`failures.push(\`Invalid value provided for the ${option.name} option - valid values include: ${(0, _stryke_string_format_list.list)(option?.choices?.map((choice) => String(choice)) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}}\`);`;
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
get children() {
|
|
128
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
129
|
-
get when() {
|
|
130
|
-
return !option.optional;
|
|
131
|
-
},
|
|
132
|
-
get fallback() {
|
|
133
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
134
|
-
get condition() {
|
|
135
|
-
return _alloy_js_core.code`![${option.choices?.map((choice) => option.kind === require_types_command.CommandParameterKinds.string ? `"${choice}"` : choice).join(", ")}].includes(options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`})`;
|
|
136
|
-
},
|
|
137
|
-
get children() {
|
|
138
|
-
return _alloy_js_core.code`failures.push(\`Invalid value provided for the ${option.name} option - valid values include: ${(0, _stryke_string_format_list.list)(option?.choices?.map((choice) => String(choice)) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}}\`);`;
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
},
|
|
142
|
-
get children() {
|
|
143
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
144
|
-
get condition() {
|
|
145
|
-
return _alloy_js_core.code`![${option.choices?.map((choice) => option.kind === require_types_command.CommandParameterKinds.string ? `"${choice}"` : choice).join(", ")}].includes(options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`})`;
|
|
146
|
-
},
|
|
147
|
-
get children() {
|
|
148
|
-
return _alloy_js_core.code`failures.push(\`Invalid value provided for the ${option.name} option - valid values include: ${(0, _stryke_string_format_list.list)(option?.choices?.map((choice) => String(choice)) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}}\`);`;
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
})
|
|
157
|
-
]
|
|
158
|
-
}),
|
|
159
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
160
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
161
|
-
get each() {
|
|
162
|
-
return command.args;
|
|
163
|
-
},
|
|
164
|
-
doubleHardline: true,
|
|
165
|
-
children: (argument) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
166
|
-
get when() {
|
|
167
|
-
return !argument.optional;
|
|
168
|
-
},
|
|
169
|
-
get children() {
|
|
170
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
171
|
-
get condition() {
|
|
172
|
-
return _alloy_js_core.code`!${(0, _stryke_string_format_camel_case.camelCase)(argument.name)}`;
|
|
173
|
-
},
|
|
174
|
-
get children() {
|
|
175
|
-
return _alloy_js_core.code`failures.push("Missing required \\"${argument.name}\\" positional argument");`;
|
|
176
|
-
}
|
|
177
|
-
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
178
|
-
get when() {
|
|
179
|
-
return (argument.kind === require_types_command.CommandParameterKinds.string || argument.kind === require_types_command.CommandParameterKinds.number) && argument.variadic;
|
|
180
|
-
},
|
|
181
|
-
get children() {
|
|
182
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
183
|
-
get condition() {
|
|
184
|
-
return _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0`;
|
|
185
|
-
},
|
|
186
|
-
get children() {
|
|
187
|
-
return _alloy_js_core.code`failures.push("No values were provided to the required ${argument.name} array positional argument");`;
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
})];
|
|
192
|
-
}
|
|
193
|
-
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
194
|
-
get when() {
|
|
195
|
-
return argument.kind === require_types_command.CommandParameterKinds.number;
|
|
196
|
-
},
|
|
197
|
-
get children() {
|
|
198
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
199
|
-
get when() {
|
|
200
|
-
return argument.variadic;
|
|
201
|
-
},
|
|
202
|
-
get fallback() {
|
|
203
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
204
|
-
get condition() {
|
|
205
|
-
return _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(argument.name)} && Number.isNaN(${(0, _stryke_string_format_camel_case.camelCase)(argument.name)})`;
|
|
206
|
-
},
|
|
207
|
-
get children() {
|
|
208
|
-
return _alloy_js_core.code`failures.push("Invalid numeric value provided for the ${argument.name} positional argument");`;
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
},
|
|
212
|
-
get children() {
|
|
213
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
214
|
-
get condition() {
|
|
215
|
-
return _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(argument.name)}.some(value => Number.isNaN(value))`;
|
|
216
|
-
},
|
|
217
|
-
get children() {
|
|
218
|
-
return _alloy_js_core.code`failures.push("Invalid numeric value provided in the ${argument.name} array positional argument");`;
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
})]
|
|
273
|
+
})], [
|
|
274
|
+
"argument",
|
|
275
|
+
"",
|
|
276
|
+
"P\"2!\"/\""
|
|
277
|
+
]);
|
|
278
|
+
}
|
|
225
279
|
})
|
|
226
280
|
];
|
|
227
281
|
}
|
|
282
|
+
CommandValidationLogic.__type = [
|
|
283
|
+
() => __ΩCommandValidationLogicProps,
|
|
284
|
+
"props",
|
|
285
|
+
"CommandValidationLogic",
|
|
286
|
+
"A component that generates command validation logic for required options and arguments.",
|
|
287
|
+
"Pn!2\"\"/#?$"
|
|
288
|
+
];
|
|
228
289
|
|
|
229
290
|
//#endregion
|
|
230
|
-
exports.CommandValidationLogic = CommandValidationLogic;
|
|
291
|
+
exports.CommandValidationLogic = CommandValidationLogic;
|
|
292
|
+
exports.__ΩCommandValidationLogicProps = __ΩCommandValidationLogicProps;
|