@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 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
- [![Version](https://img.shields.io/badge/version-0.1.5-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/shell-shock/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/shell-shock/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
30
+ [![Version](https://img.shields.io/badge/version-0.1.6-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/shell-shock/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/shell-shock/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
31
31
 
32
32
  <!-- prettier-ignore-start -->
33
33
  <!-- markdownlint-disable -->
@@ -1,11 +1,11 @@
1
- import * as _alloy_js_core1 from "@alloy-js/core";
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): _alloy_js_core1.Children;
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 _alloy_js_core0 from "@alloy-js/core";
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): _alloy_js_core0.Children;
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
- "getArgs",
69
+ "useApp",
70
+ "useArgs",
69
71
  "hasFlag",
70
72
  "isMinimal",
71
73
  "isInteractive",
74
+ "isHelp",
72
75
  "isUnicodeSupported",
73
- "internal_commandContextStore"
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.ElseClause, { get children() {
91
- return [
92
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
93
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
94
- get each() {
95
- return Object.values(command.options ?? {});
96
- },
97
- doubleHardline: true,
98
- children: (option) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
99
- get when() {
100
- return !option.optional;
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
- get children() {
103
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
104
- get condition() {
105
- return __alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}`;
106
- },
107
- get children() {
108
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Switch, { get children() {
109
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
110
- get when() {
111
- return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
112
- },
113
- get children() {
114
- return __alloy_js_core.code`
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
- }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
138
- get when() {
139
- return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean;
140
- },
141
- get children() {
142
- return __alloy_js_core.code`
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
- }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
152
- get when() {
153
- return (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && option.variadic;
154
- },
155
- get children() {
156
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
157
- get condition() {
158
- return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
159
- },
160
- get children() {
161
- return __alloy_js_core.code`
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
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
195
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
196
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
197
- get each() {
198
- return command.arguments;
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
- get children() {
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)}`;
209
- },
210
- get children() {
211
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Switch, { get children() {
212
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
213
- get when() {
214
- return argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
215
- },
216
- get children() {
217
- return __alloy_js_core.code`
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
- }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
241
- get when() {
242
- return argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean;
243
- },
244
- get children() {
245
- return __alloy_js_core.code`
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
- }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
255
- get when() {
256
- return (argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && argument.variadic;
257
- },
258
- get children() {
259
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
260
- get condition() {
261
- return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0`;
262
- },
263
- get children() {
264
- return __alloy_js_core.code`
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 _alloy_js_core0 from "@alloy-js/core";
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): _alloy_js_core0.Children;
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 _alloy_js_core1 from "@alloy-js/core";
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): _alloy_js_core1.Children;
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