@shell-shock/preset-cli 0.2.0 → 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 +128 -111
- package/dist/components/command-entry.d.cts +2 -2
- package/dist/components/command-entry.d.mts +2 -2
- package/dist/components/command-entry.mjs +130 -113
- 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.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 +19 -5
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";
|
|
@@ -47,7 +47,6 @@ function CommandEntry(props) {
|
|
|
47
47
|
return (0, defu.default)(builtinImports ?? {}, {
|
|
48
48
|
env: [
|
|
49
49
|
"env",
|
|
50
|
-
"isCI",
|
|
51
50
|
"isDevelopment",
|
|
52
51
|
"isDebug"
|
|
53
52
|
],
|
|
@@ -62,15 +61,19 @@ function CommandEntry(props) {
|
|
|
62
61
|
"splitText",
|
|
63
62
|
"text",
|
|
64
63
|
"confirm",
|
|
65
|
-
"isCancel"
|
|
64
|
+
"isCancel",
|
|
65
|
+
"intro",
|
|
66
|
+
"outro"
|
|
66
67
|
],
|
|
67
68
|
utils: [
|
|
68
|
-
"
|
|
69
|
+
"useApp",
|
|
70
|
+
"useArgs",
|
|
69
71
|
"hasFlag",
|
|
70
72
|
"isMinimal",
|
|
71
73
|
"isInteractive",
|
|
74
|
+
"isHelp",
|
|
72
75
|
"isUnicodeSupported",
|
|
73
|
-
"
|
|
76
|
+
"internal_commandContext"
|
|
74
77
|
]
|
|
75
78
|
});
|
|
76
79
|
},
|
|
@@ -87,31 +90,39 @@ function CommandEntry(props) {
|
|
|
87
90
|
get children() {
|
|
88
91
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandValidationLogic, { command });
|
|
89
92
|
}
|
|
90
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.
|
|
91
|
-
|
|
92
|
-
(0,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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 ?? {});
|
|
101
107
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
108
|
+
doubleHardline: true,
|
|
109
|
+
children: (option) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
110
|
+
get when() {
|
|
111
|
+
return !option.optional;
|
|
112
|
+
},
|
|
113
|
+
get children() {
|
|
114
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
115
|
+
get condition() {
|
|
116
|
+
return __alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}`;
|
|
117
|
+
},
|
|
118
|
+
get children() {
|
|
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`
|
|
115
126
|
const value = await text({
|
|
116
127
|
message: 'Please provide a value for the ${option.title} option:',
|
|
117
128
|
validate(value) {
|
|
@@ -133,32 +144,32 @@ function CommandEntry(props) {
|
|
|
133
144
|
|
|
134
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"};
|
|
135
146
|
`;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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`
|
|
143
154
|
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = await confirm({
|
|
144
155
|
message: 'Please select a value for the ${option.title} option:'
|
|
145
156
|
});
|
|
146
157
|
`;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
}
|
|
159
|
+
})];
|
|
160
|
+
} });
|
|
161
|
+
}
|
|
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;
|
|
165
|
+
},
|
|
166
|
+
get children() {
|
|
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`
|
|
162
173
|
const value = await text({
|
|
163
174
|
message: 'Please provide one or more values for the ${option.title} option (values are separated by a "," character):',
|
|
164
175
|
validate(value) {
|
|
@@ -184,37 +195,37 @@ function CommandEntry(props) {
|
|
|
184
195
|
|
|
185
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)` : ""} ;
|
|
186
197
|
`;
|
|
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;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
})];
|
|
202
|
+
}
|
|
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;
|
|
204
210
|
},
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
211
|
+
doubleHardline: true,
|
|
212
|
+
children: (argument) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
213
|
+
get when() {
|
|
214
|
+
return !argument.optional;
|
|
215
|
+
},
|
|
216
|
+
get children() {
|
|
217
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
218
|
+
get condition() {
|
|
219
|
+
return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}`;
|
|
220
|
+
},
|
|
221
|
+
get children() {
|
|
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`
|
|
218
229
|
const value = await text({
|
|
219
230
|
message: 'Please provide a value for the ${argument.title} positional argument:',
|
|
220
231
|
validate(value) {
|
|
@@ -236,32 +247,32 @@ function CommandEntry(props) {
|
|
|
236
247
|
|
|
237
248
|
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = ${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `Number(value)` : "value"};
|
|
238
249
|
`;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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`
|
|
246
257
|
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = await confirm({
|
|
247
258
|
message: 'Please select a value for the ${argument.title} positional argument:'
|
|
248
259
|
});
|
|
249
260
|
`;
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
261
|
+
}
|
|
262
|
+
})];
|
|
263
|
+
} });
|
|
264
|
+
}
|
|
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;
|
|
268
|
+
},
|
|
269
|
+
get children() {
|
|
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`
|
|
265
276
|
const value = await text({
|
|
266
277
|
message: 'Please provide one or more values for the ${argument.title} option (values are separated by a "," character):',
|
|
267
278
|
validate(value) {
|
|
@@ -288,15 +299,21 @@ function CommandEntry(props) {
|
|
|
288
299
|
|
|
289
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)` : ""} ;
|
|
290
301
|
`;
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
})];
|
|
306
|
+
}
|
|
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
|
+
})];
|
|
300
317
|
}
|
|
301
318
|
})
|
|
302
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,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
|