@shell-shock/preset-script 0.1.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.
Files changed (76) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +264 -0
  3. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  4. package/dist/components/builtin/console.cjs +1232 -0
  5. package/dist/components/builtin/console.cjs.map +1 -0
  6. package/dist/components/builtin/console.d.cts +37 -0
  7. package/dist/components/builtin/console.d.mts +37 -0
  8. package/dist/components/builtin/console.mjs +1225 -0
  9. package/dist/components/builtin/console.mjs.map +1 -0
  10. package/dist/components/builtin/index.cjs +9 -0
  11. package/dist/components/builtin/index.d.cts +2 -0
  12. package/dist/components/builtin/index.d.mts +2 -0
  13. package/dist/components/builtin/index.mjs +3 -0
  14. package/dist/components/command-router.cjs +103 -0
  15. package/dist/components/command-router.cjs.map +1 -0
  16. package/dist/components/command-router.d.cts +8 -0
  17. package/dist/components/command-router.d.mts +8 -0
  18. package/dist/components/command-router.mjs +101 -0
  19. package/dist/components/command-router.mjs.map +1 -0
  20. package/dist/components/entry/bin.cjs +92 -0
  21. package/dist/components/entry/bin.cjs.map +1 -0
  22. package/dist/components/entry/bin.d.cts +15 -0
  23. package/dist/components/entry/bin.d.mts +15 -0
  24. package/dist/components/entry/bin.mjs +91 -0
  25. package/dist/components/entry/bin.mjs.map +1 -0
  26. package/dist/components/entry/command.cjs +54 -0
  27. package/dist/components/entry/command.cjs.map +1 -0
  28. package/dist/components/entry/command.d.cts +15 -0
  29. package/dist/components/entry/command.d.mts +15 -0
  30. package/dist/components/entry/command.mjs +53 -0
  31. package/dist/components/entry/command.mjs.map +1 -0
  32. package/dist/components/entry/index.cjs +3 -0
  33. package/dist/components/entry/index.d.cts +2 -0
  34. package/dist/components/entry/index.d.mts +2 -0
  35. package/dist/components/entry/index.mjs +3 -0
  36. package/dist/components/index.cjs +19 -0
  37. package/dist/components/index.d.cts +7 -0
  38. package/dist/components/index.d.mts +7 -0
  39. package/dist/components/index.mjs +8 -0
  40. package/dist/components/shutdown.cjs +93 -0
  41. package/dist/components/shutdown.cjs.map +1 -0
  42. package/dist/components/shutdown.d.cts +14 -0
  43. package/dist/components/shutdown.d.mts +14 -0
  44. package/dist/components/shutdown.mjs +91 -0
  45. package/dist/components/shutdown.mjs.map +1 -0
  46. package/dist/contexts/command.cjs +21 -0
  47. package/dist/contexts/command.cjs.map +1 -0
  48. package/dist/contexts/command.mjs +19 -0
  49. package/dist/contexts/command.mjs.map +1 -0
  50. package/dist/contexts/theme.cjs +29 -0
  51. package/dist/contexts/theme.cjs.map +1 -0
  52. package/dist/contexts/theme.mjs +27 -0
  53. package/dist/contexts/theme.mjs.map +1 -0
  54. package/dist/helpers/ansi-utils.cjs +484 -0
  55. package/dist/helpers/ansi-utils.cjs.map +1 -0
  56. package/dist/helpers/ansi-utils.mjs +483 -0
  57. package/dist/helpers/ansi-utils.mjs.map +1 -0
  58. package/dist/helpers/get-default-options.cjs +57 -0
  59. package/dist/helpers/get-default-options.cjs.map +1 -0
  60. package/dist/helpers/get-default-options.mjs +56 -0
  61. package/dist/helpers/get-default-options.mjs.map +1 -0
  62. package/dist/index.cjs +65 -0
  63. package/dist/index.cjs.map +1 -0
  64. package/dist/index.d.cts +12 -0
  65. package/dist/index.d.mts +12 -0
  66. package/dist/index.mjs +59 -0
  67. package/dist/index.mjs.map +1 -0
  68. package/dist/types/index.cjs +0 -0
  69. package/dist/types/index.d.cts +2 -0
  70. package/dist/types/index.d.mts +2 -0
  71. package/dist/types/index.mjs +1 -0
  72. package/dist/types/plugin.cjs +0 -0
  73. package/dist/types/plugin.d.cts +32 -0
  74. package/dist/types/plugin.d.mts +32 -0
  75. package/dist/types/plugin.mjs +1 -0
  76. package/package.json +181 -0
@@ -0,0 +1,483 @@
1
+ //#region src/helpers/ansi-utils.ts
2
+ const ANSI_BACKGROUND_OFFSET = 10;
3
+ const modifiers = {
4
+ reset: [0, 0],
5
+ bold: [1, 22],
6
+ dim: [2, 22],
7
+ italic: [3, 23],
8
+ underline: [4, 24],
9
+ overline: [53, 55],
10
+ inverse: [7, 27],
11
+ hidden: [8, 28],
12
+ strikethrough: [9, 29]
13
+ };
14
+ const colors = {
15
+ black: [30, 39],
16
+ red: [31, 39],
17
+ green: [32, 39],
18
+ yellow: [33, 39],
19
+ blue: [34, 39],
20
+ magenta: [35, 39],
21
+ cyan: [36, 39],
22
+ white: [37, 39],
23
+ blackBright: [90, 39],
24
+ gray: [90, 39],
25
+ grey: [90, 39],
26
+ redBright: [91, 39],
27
+ greenBright: [92, 39],
28
+ yellowBright: [93, 39],
29
+ blueBright: [94, 39],
30
+ magentaBright: [95, 39],
31
+ cyanBright: [96, 39],
32
+ whiteBright: [97, 39]
33
+ };
34
+ const bgColors = {
35
+ bgBlack: [40, 49],
36
+ bgRed: [41, 49],
37
+ bgGreen: [42, 49],
38
+ bgYellow: [43, 49],
39
+ bgBlue: [44, 49],
40
+ bgMagenta: [45, 49],
41
+ bgCyan: [46, 49],
42
+ bgWhite: [47, 49],
43
+ bgBlackBright: [100, 49],
44
+ bgGray: [100, 49],
45
+ bgGrey: [100, 49],
46
+ bgRedBright: [101, 49],
47
+ bgGreenBright: [102, 49],
48
+ bgYellowBright: [103, 49],
49
+ bgBlueBright: [104, 49],
50
+ bgMagentaBright: [105, 49],
51
+ bgCyanBright: [106, 49],
52
+ bgWhiteBright: [107, 49]
53
+ };
54
+ const wrapAnsi16 = (offset = 0) => (code) => `\\u001b[${code + offset}m`;
55
+ const wrapAnsi256 = (offset = 0) => (code) => `\\u001b[${38 + offset};5;${code}m`;
56
+ const wrapAnsi16m = (offset = 0) => (code) => {
57
+ const [red, green, blue] = hexToRgb(code);
58
+ return `\\u001b[${38 + offset};2;${red};${green};${blue}m`;
59
+ };
60
+ function rgbToAnsi256(red, green, blue) {
61
+ if (red === green && green === blue) {
62
+ if (red < 8) return 16;
63
+ if (red > 248) return 231;
64
+ return Math.round((red - 8) / 247 * 24) + 232;
65
+ }
66
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
67
+ }
68
+ function hexToRgb(hex) {
69
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
70
+ if (!matches) return [
71
+ 0,
72
+ 0,
73
+ 0
74
+ ];
75
+ let [colorString] = matches;
76
+ if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
77
+ const integer = Number.parseInt(colorString, 16);
78
+ return [
79
+ integer >> 16 & 255,
80
+ integer >> 8 & 255,
81
+ integer & 255
82
+ ];
83
+ }
84
+ function hexToAnsi256(hex) {
85
+ return rgbToAnsi256(...hexToRgb(hex));
86
+ }
87
+ function ansi256ToAnsi(code) {
88
+ if (code < 8) return 30 + code;
89
+ if (code < 16) return 90 + (code - 8);
90
+ let red;
91
+ let green;
92
+ let blue;
93
+ if (code >= 232) {
94
+ red = ((code - 232) * 10 + 8) / 255;
95
+ green = red;
96
+ blue = red;
97
+ } else {
98
+ code -= 16;
99
+ const remainder = code % 36;
100
+ red = Math.floor(code / 36) / 5;
101
+ green = Math.floor(remainder / 6) / 5;
102
+ blue = remainder % 6 / 5;
103
+ }
104
+ const value = Math.max(red, green, blue) * 2;
105
+ if (value === 0) return 30;
106
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
107
+ if (value === 2) result += 60;
108
+ return result;
109
+ }
110
+ function hexToAnsi(hex) {
111
+ return ansi256ToAnsi(hexToAnsi256(hex));
112
+ }
113
+ function buildThemeAnsiStyles(theme, wrapFn, convertFn) {
114
+ return {
115
+ text: {
116
+ banner: {
117
+ title: {
118
+ open: wrapFn()(convertFn(theme.text.banner.title)),
119
+ close: wrapAnsi16()(39)
120
+ },
121
+ command: {
122
+ open: wrapFn()(convertFn(theme.text.banner.command)),
123
+ close: wrapAnsi16()(39)
124
+ },
125
+ description: {
126
+ open: wrapFn()(convertFn(theme.text.banner.description)),
127
+ close: wrapAnsi16()(39)
128
+ },
129
+ header: {
130
+ open: wrapFn()(convertFn(theme.text.banner.header)),
131
+ close: wrapAnsi16()(39)
132
+ },
133
+ footer: {
134
+ open: wrapFn()(convertFn(theme.text.banner.footer)),
135
+ close: wrapAnsi16()(39)
136
+ }
137
+ },
138
+ heading: {
139
+ primary: {
140
+ open: wrapFn()(convertFn(theme.text.heading.primary)),
141
+ close: wrapAnsi16()(39)
142
+ },
143
+ secondary: {
144
+ open: wrapFn()(convertFn(theme.text.heading.secondary)),
145
+ close: wrapAnsi16()(39)
146
+ },
147
+ tertiary: {
148
+ open: wrapFn()(convertFn(theme.text.heading.tertiary)),
149
+ close: wrapAnsi16()(39)
150
+ }
151
+ },
152
+ body: {
153
+ primary: {
154
+ open: wrapFn()(convertFn(theme.text.body.primary)),
155
+ close: wrapAnsi16()(39)
156
+ },
157
+ secondary: {
158
+ open: wrapFn()(convertFn(theme.text.body.secondary)),
159
+ close: wrapAnsi16()(39)
160
+ },
161
+ tertiary: {
162
+ open: wrapFn()(convertFn(theme.text.body.tertiary)),
163
+ close: wrapAnsi16()(39)
164
+ },
165
+ link: {
166
+ open: wrapFn()(convertFn(theme.text.body.link)),
167
+ close: wrapAnsi16()(39)
168
+ }
169
+ },
170
+ message: {
171
+ description: {
172
+ help: {
173
+ open: wrapFn()(convertFn(theme.text.message.description.help)),
174
+ close: wrapAnsi16()(39)
175
+ },
176
+ success: {
177
+ open: wrapFn()(convertFn(theme.text.message.description.success)),
178
+ close: wrapAnsi16()(39)
179
+ },
180
+ info: {
181
+ open: wrapFn()(convertFn(theme.text.message.description.info)),
182
+ close: wrapAnsi16()(39)
183
+ },
184
+ warning: {
185
+ open: wrapFn()(convertFn(theme.text.message.description.warning)),
186
+ close: wrapAnsi16()(39)
187
+ },
188
+ danger: {
189
+ open: wrapFn()(convertFn(theme.text.message.description.danger)),
190
+ close: wrapAnsi16()(39)
191
+ },
192
+ error: {
193
+ open: wrapFn()(convertFn(theme.text.message.description.error)),
194
+ close: wrapAnsi16()(39)
195
+ }
196
+ },
197
+ link: {
198
+ help: {
199
+ open: wrapFn()(convertFn(theme.text.message.link.help)),
200
+ close: wrapAnsi16()(39)
201
+ },
202
+ success: {
203
+ open: wrapFn()(convertFn(theme.text.message.link.success)),
204
+ close: wrapAnsi16()(39)
205
+ },
206
+ info: {
207
+ open: wrapFn()(convertFn(theme.text.message.link.info)),
208
+ close: wrapAnsi16()(39)
209
+ },
210
+ warning: {
211
+ open: wrapFn()(convertFn(theme.text.message.link.warning)),
212
+ close: wrapAnsi16()(39)
213
+ },
214
+ danger: {
215
+ open: wrapFn()(convertFn(theme.text.message.link.danger)),
216
+ close: wrapAnsi16()(39)
217
+ },
218
+ error: {
219
+ open: wrapFn()(convertFn(theme.text.message.link.error)),
220
+ close: wrapAnsi16()(39)
221
+ }
222
+ },
223
+ header: {
224
+ help: {
225
+ open: wrapFn()(convertFn(theme.text.message.header.help)),
226
+ close: wrapAnsi16()(39)
227
+ },
228
+ success: {
229
+ open: wrapFn()(convertFn(theme.text.message.header.success)),
230
+ close: wrapAnsi16()(39)
231
+ },
232
+ info: {
233
+ open: wrapFn()(convertFn(theme.text.message.header.info)),
234
+ close: wrapAnsi16()(39)
235
+ },
236
+ warning: {
237
+ open: wrapFn()(convertFn(theme.text.message.header.warning)),
238
+ close: wrapAnsi16()(39)
239
+ },
240
+ danger: {
241
+ open: wrapFn()(convertFn(theme.text.message.header.danger)),
242
+ close: wrapAnsi16()(39)
243
+ },
244
+ error: {
245
+ open: wrapFn()(convertFn(theme.text.message.header.error)),
246
+ close: wrapAnsi16()(39)
247
+ }
248
+ },
249
+ footer: {
250
+ help: {
251
+ open: wrapFn()(convertFn(theme.text.message.footer.help)),
252
+ close: wrapAnsi16()(39)
253
+ },
254
+ success: {
255
+ open: wrapFn()(convertFn(theme.text.message.footer.success)),
256
+ close: wrapAnsi16()(39)
257
+ },
258
+ info: {
259
+ open: wrapFn()(convertFn(theme.text.message.footer.info)),
260
+ close: wrapAnsi16()(39)
261
+ },
262
+ warning: {
263
+ open: wrapFn()(convertFn(theme.text.message.footer.warning)),
264
+ close: wrapAnsi16()(39)
265
+ },
266
+ danger: {
267
+ open: wrapFn()(convertFn(theme.text.message.footer.danger)),
268
+ close: wrapAnsi16()(39)
269
+ },
270
+ error: {
271
+ open: wrapFn()(convertFn(theme.text.message.footer.error)),
272
+ close: wrapAnsi16()(39)
273
+ }
274
+ }
275
+ },
276
+ usage: {
277
+ bin: {
278
+ open: wrapFn()(convertFn(theme.text.usage.bin)),
279
+ close: wrapAnsi16()(39)
280
+ },
281
+ command: {
282
+ open: wrapFn()(convertFn(theme.text.usage.command)),
283
+ close: wrapAnsi16()(39)
284
+ },
285
+ subcommand: {
286
+ open: wrapFn()(convertFn(theme.text.usage.subcommand)),
287
+ close: wrapAnsi16()(39)
288
+ },
289
+ options: {
290
+ open: wrapFn()(convertFn(theme.text.usage.options)),
291
+ close: wrapAnsi16()(39)
292
+ },
293
+ params: {
294
+ open: wrapFn()(convertFn(theme.text.usage.params)),
295
+ close: wrapAnsi16()(39)
296
+ },
297
+ description: {
298
+ open: wrapFn()(convertFn(theme.text.usage.description)),
299
+ close: wrapAnsi16()(39)
300
+ }
301
+ }
302
+ },
303
+ border: {
304
+ banner: {
305
+ divider: {
306
+ primary: {
307
+ open: wrapFn()(convertFn(theme.border.banner.divider.primary)),
308
+ close: wrapAnsi16()(39)
309
+ },
310
+ secondary: {
311
+ open: wrapFn()(convertFn(theme.border.banner.divider.secondary)),
312
+ close: wrapAnsi16()(39)
313
+ },
314
+ tertiary: {
315
+ open: wrapFn()(convertFn(theme.border.banner.divider.tertiary)),
316
+ close: wrapAnsi16()(39)
317
+ }
318
+ },
319
+ outline: {
320
+ primary: {
321
+ open: wrapFn()(convertFn(theme.border.banner.outline.primary)),
322
+ close: wrapAnsi16()(39)
323
+ },
324
+ secondary: {
325
+ open: wrapFn()(convertFn(theme.border.banner.outline.secondary)),
326
+ close: wrapAnsi16()(39)
327
+ },
328
+ tertiary: {
329
+ open: wrapFn()(convertFn(theme.border.banner.outline.tertiary)),
330
+ close: wrapAnsi16()(39)
331
+ }
332
+ }
333
+ },
334
+ app: {
335
+ divider: {
336
+ primary: {
337
+ open: wrapFn()(convertFn(theme.border.app.divider.primary)),
338
+ close: wrapAnsi16()(39)
339
+ },
340
+ secondary: {
341
+ open: wrapFn()(convertFn(theme.border.app.divider.secondary)),
342
+ close: wrapAnsi16()(39)
343
+ },
344
+ tertiary: {
345
+ open: wrapFn()(convertFn(theme.border.app.divider.tertiary)),
346
+ close: wrapAnsi16()(39)
347
+ }
348
+ },
349
+ outline: {
350
+ primary: {
351
+ open: wrapFn()(convertFn(theme.border.app.outline.primary)),
352
+ close: wrapAnsi16()(39)
353
+ },
354
+ secondary: {
355
+ open: wrapFn()(convertFn(theme.border.app.outline.secondary)),
356
+ close: wrapAnsi16()(39)
357
+ },
358
+ tertiary: {
359
+ open: wrapFn()(convertFn(theme.border.app.outline.tertiary)),
360
+ close: wrapAnsi16()(39)
361
+ }
362
+ }
363
+ },
364
+ message: {
365
+ divider: {
366
+ help: {
367
+ open: wrapFn()(convertFn(theme.border.message.divider.help)),
368
+ close: wrapAnsi16()(39)
369
+ },
370
+ success: {
371
+ open: wrapFn()(convertFn(theme.border.message.divider.success)),
372
+ close: wrapAnsi16()(39)
373
+ },
374
+ info: {
375
+ open: wrapFn()(convertFn(theme.border.message.divider.info)),
376
+ close: wrapAnsi16()(39)
377
+ },
378
+ warning: {
379
+ open: wrapFn()(convertFn(theme.border.message.divider.warning)),
380
+ close: wrapAnsi16()(39)
381
+ },
382
+ danger: {
383
+ open: wrapFn()(convertFn(theme.border.message.divider.danger)),
384
+ close: wrapAnsi16()(39)
385
+ },
386
+ error: {
387
+ open: wrapFn()(convertFn(theme.border.message.divider.error)),
388
+ close: wrapAnsi16()(39)
389
+ }
390
+ },
391
+ outline: {
392
+ help: {
393
+ open: wrapFn()(convertFn(theme.border.message.outline.help)),
394
+ close: wrapAnsi16()(39)
395
+ },
396
+ success: {
397
+ open: wrapFn()(convertFn(theme.border.message.outline.success)),
398
+ close: wrapAnsi16()(39)
399
+ },
400
+ info: {
401
+ open: wrapFn()(convertFn(theme.border.message.outline.info)),
402
+ close: wrapAnsi16()(39)
403
+ },
404
+ warning: {
405
+ open: wrapFn()(convertFn(theme.border.message.outline.warning)),
406
+ close: wrapAnsi16()(39)
407
+ },
408
+ danger: {
409
+ open: wrapFn()(convertFn(theme.border.message.outline.danger)),
410
+ close: wrapAnsi16()(39)
411
+ },
412
+ error: {
413
+ open: wrapFn()(convertFn(theme.border.message.outline.error)),
414
+ close: wrapAnsi16()(39)
415
+ }
416
+ }
417
+ }
418
+ }
419
+ };
420
+ }
421
+ /**
422
+ * Generates ANSI styles based on the provided context.
423
+ *
424
+ * @param theme - The theme colors configuration.
425
+ * @returns The generated ANSI styles.
426
+ */
427
+ function getAnsiStyles(theme) {
428
+ const output = {
429
+ ansi16: {},
430
+ ansi256: {},
431
+ ansi16m: {}
432
+ };
433
+ for (const [key, value] of Object.entries(modifiers)) {
434
+ output.ansi16[key] = {
435
+ open: wrapAnsi16()(value[0]),
436
+ close: wrapAnsi16()(value[1])
437
+ };
438
+ output.ansi256[key] = {
439
+ open: wrapAnsi16()(value[0]),
440
+ close: wrapAnsi16()(value[1])
441
+ };
442
+ output.ansi16m[key] = {
443
+ open: wrapAnsi16()(value[0]),
444
+ close: wrapAnsi16()(value[1])
445
+ };
446
+ }
447
+ for (const [key, value] of Object.entries(colors)) {
448
+ output.ansi16[key] = {
449
+ open: wrapAnsi16()(value[0]),
450
+ close: wrapAnsi16()(value[1])
451
+ };
452
+ output.ansi256[key] = {
453
+ open: wrapAnsi16()(value[0]),
454
+ close: wrapAnsi16()(value[1])
455
+ };
456
+ output.ansi16m[key] = {
457
+ open: wrapAnsi16()(value[0]),
458
+ close: wrapAnsi16()(value[1])
459
+ };
460
+ }
461
+ for (const [key, value] of Object.entries(bgColors)) {
462
+ output.ansi16[key] = {
463
+ open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),
464
+ close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])
465
+ };
466
+ output.ansi256[key] = {
467
+ open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),
468
+ close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])
469
+ };
470
+ output.ansi16m[key] = {
471
+ open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),
472
+ close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])
473
+ };
474
+ }
475
+ output.ansi16.theme = buildThemeAnsiStyles(theme, wrapAnsi16, hexToAnsi);
476
+ output.ansi256.theme = buildThemeAnsiStyles(theme, wrapAnsi256, hexToAnsi256);
477
+ output.ansi16m.theme = buildThemeAnsiStyles(theme, wrapAnsi16m, (code) => code);
478
+ return output;
479
+ }
480
+
481
+ //#endregion
482
+ export { getAnsiStyles };
483
+ //# sourceMappingURL=ansi-utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ansi-utils.mjs","names":["ANSI_BACKGROUND_OFFSET","modifiers","reset","bold","dim","italic","underline","overline","inverse","hidden","strikethrough","colors","black","red","green","yellow","blue","magenta","cyan","white","blackBright","gray","grey","redBright","greenBright","yellowBright","blueBright","magentaBright","cyanBright","whiteBright","bgColors","bgBlack","bgRed","bgGreen","bgYellow","bgBlue","bgMagenta","bgCyan","bgWhite","bgBlackBright","bgGray","bgGrey","bgRedBright","bgGreenBright","bgYellowBright","bgBlueBright","bgMagentaBright","bgCyanBright","bgWhiteBright","wrapAnsi16","offset","code","wrapAnsi256","wrapAnsi16m","hexToRgb","rgbToAnsi256","Math","round","hex","matches","exec","toString","colorString","length","map","character","join","integer","Number","parseInt","hexToAnsi256","ansi256ToAnsi","remainder","floor","value","max","result","hexToAnsi","buildThemeAnsiStyles","theme","wrapFn","convertFn","text","banner","title","open","close","command","description","header","footer","heading","primary","secondary","tertiary","body","link","message","help","success","info","warning","danger","error","usage","bin","subcommand","options","params","border","divider","outline","app","getAnsiStyles","output","ansi16","ansi256","ansi16m","key","Object","entries"],"sources":["../../src/helpers/ansi-utils.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ThemeColorsResolvedConfig } from \"@shell-shock/plugin-theme/types/theme\";\n\nconst ANSI_BACKGROUND_OFFSET = 10;\n\nexport const modifiers = {\n reset: [0, 0],\n bold: [1, 22],\n dim: [2, 22],\n italic: [3, 23],\n underline: [4, 24],\n overline: [53, 55],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29]\n};\n\nexport const colors = {\n black: [30, 39],\n red: [31, 39],\n green: [32, 39],\n yellow: [33, 39],\n blue: [34, 39],\n magenta: [35, 39],\n cyan: [36, 39],\n white: [37, 39],\n\n // Bright color\n blackBright: [90, 39],\n gray: [90, 39],\n grey: [90, 39],\n redBright: [91, 39],\n greenBright: [92, 39],\n yellowBright: [93, 39],\n blueBright: [94, 39],\n magentaBright: [95, 39],\n cyanBright: [96, 39],\n whiteBright: [97, 39]\n};\n\nexport const bgColors = {\n bgBlack: [40, 49],\n bgRed: [41, 49],\n bgGreen: [42, 49],\n bgYellow: [43, 49],\n bgBlue: [44, 49],\n bgMagenta: [45, 49],\n bgCyan: [46, 49],\n bgWhite: [47, 49],\n\n // Bright color\n bgBlackBright: [100, 49],\n bgGray: [100, 49],\n bgGrey: [100, 49],\n bgRedBright: [101, 49],\n bgGreenBright: [102, 49],\n bgYellowBright: [103, 49],\n bgBlueBright: [104, 49],\n bgMagentaBright: [105, 49],\n bgCyanBright: [106, 49],\n bgWhiteBright: [107, 49]\n};\n\nexport interface AnsiWrappers {\n open: string;\n close: string;\n}\n\ntype WrapAnsiFn = (offset?: number) => (code: number) => string;\ntype WrapAnsi16mFn = (offset?: number) => (code: string) => string;\n\nconst wrapAnsi16: WrapAnsiFn =\n (offset = 0) =>\n (code: number) =>\n `\\\\u001b[${code + offset}m`;\n\nconst wrapAnsi256: WrapAnsiFn =\n (offset = 0) =>\n (code: number) =>\n `\\\\u001b[${38 + offset};5;${code}m`;\n\nconst wrapAnsi16m: WrapAnsi16mFn =\n (offset = 0) =>\n (code: string) => {\n const [red, green, blue] = hexToRgb(code);\n\n return `\\\\u001b[${38 + offset};2;${red};${green};${blue}m`;\n };\n\nexport type BaseAnsiStylesKeys =\n | keyof typeof modifiers\n | keyof typeof colors\n | keyof typeof bgColors;\n\nexport type BaseAnsiStyles = Record<\n \"ansi16\" | \"ansi256\" | \"ansi16m\",\n Record<BaseAnsiStylesKeys, AnsiWrappers>\n>;\n\ntype ThemeAnsiStylesFormat<T> = T extends object\n ? {\n [K in keyof T]: ThemeAnsiStylesFormat<T[K]>;\n }\n : AnsiWrappers;\n\nexport type ThemeAnsiStyles = Record<\n \"ansi16\" | \"ansi256\" | \"ansi16m\",\n { theme: ThemeAnsiStylesFormat<ThemeColorsResolvedConfig> }\n>;\n\nexport type AnsiStyles = BaseAnsiStyles & ThemeAnsiStyles;\n\nfunction rgbToAnsi256(red: number, green: number, blue: number): number {\n if (red === green && green === blue) {\n if (red < 8) {\n return 16;\n }\n\n if (red > 248) {\n return 231;\n }\n\n return Math.round(((red - 8) / 247) * 24) + 232;\n }\n\n return (\n 16 +\n 36 * Math.round((red / 255) * 5) +\n 6 * Math.round((green / 255) * 5) +\n Math.round((blue / 255) * 5)\n );\n}\n\nfunction hexToRgb(hex: string | number): [number, number, number] {\n const matches = /[a-f\\d]{6}|[a-f\\d]{3}/i.exec(hex.toString(16));\n if (!matches) {\n return [0, 0, 0];\n }\n\n let [colorString] = matches;\n\n if (colorString.length === 3) {\n colorString = [...colorString]\n .map(character => character + character)\n .join(\"\");\n }\n\n const integer = Number.parseInt(colorString, 16);\n\n return [(integer >> 16) & 0xff, (integer >> 8) & 0xff, integer & 0xff];\n}\n\nfunction hexToAnsi256(hex: string | number): number {\n return rgbToAnsi256(...hexToRgb(hex));\n}\n\nfunction ansi256ToAnsi(code: number): number {\n if (code < 8) {\n return 30 + code;\n }\n\n if (code < 16) {\n return 90 + (code - 8);\n }\n\n let red;\n let green;\n let blue;\n\n if (code >= 232) {\n red = ((code - 232) * 10 + 8) / 255;\n green = red;\n blue = red;\n } else {\n code -= 16;\n\n const remainder = code % 36;\n\n red = Math.floor(code / 36) / 5;\n green = Math.floor(remainder / 6) / 5;\n blue = (remainder % 6) / 5;\n }\n\n const value = Math.max(red, green, blue) * 2;\n\n if (value === 0) {\n return 30;\n }\n\n let result =\n 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));\n\n if (value === 2) {\n result += 60;\n }\n\n return result;\n}\n\n// function rgbToAnsi(red: number, green: number, blue: number): number {\n// return ansi256ToAnsi(rgbToAnsi256(red, green, blue));\n// }\n\nfunction hexToAnsi(hex: string | number): number {\n return ansi256ToAnsi(hexToAnsi256(hex));\n}\n\nfunction buildThemeAnsiStyles(\n theme: ThemeColorsResolvedConfig,\n wrapFn: (offset?: number) => (code: any) => string,\n convertFn: (code: string) => any\n): ThemeAnsiStylesFormat<ThemeColorsResolvedConfig> {\n return {\n text: {\n banner: {\n title: {\n open: wrapFn()(convertFn(theme.text.banner.title)),\n close: wrapAnsi16()(39)\n },\n command: {\n open: wrapFn()(convertFn(theme.text.banner.command)),\n close: wrapAnsi16()(39)\n },\n description: {\n open: wrapFn()(convertFn(theme.text.banner.description)),\n close: wrapAnsi16()(39)\n },\n header: {\n open: wrapFn()(convertFn(theme.text.banner.header)),\n close: wrapAnsi16()(39)\n },\n footer: {\n open: wrapFn()(convertFn(theme.text.banner.footer)),\n close: wrapAnsi16()(39)\n }\n },\n heading: {\n primary: {\n open: wrapFn()(convertFn(theme.text.heading.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.text.heading.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.text.heading.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n body: {\n primary: {\n open: wrapFn()(convertFn(theme.text.body.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.text.body.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.text.body.tertiary)),\n close: wrapAnsi16()(39)\n },\n link: {\n open: wrapFn()(convertFn(theme.text.body.link)),\n close: wrapAnsi16()(39)\n }\n },\n message: {\n description: {\n help: {\n open: wrapFn()(convertFn(theme.text.message.description.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.text.message.description.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.text.message.description.info)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.text.message.description.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.text.message.description.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.text.message.description.error)),\n close: wrapAnsi16()(39)\n }\n },\n link: {\n help: {\n open: wrapFn()(convertFn(theme.text.message.link.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.text.message.link.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.text.message.link.info)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.text.message.link.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.text.message.link.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.text.message.link.error)),\n close: wrapAnsi16()(39)\n }\n },\n header: {\n help: {\n open: wrapFn()(convertFn(theme.text.message.header.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.text.message.header.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.text.message.header.info)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.text.message.header.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.text.message.header.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.text.message.header.error)),\n close: wrapAnsi16()(39)\n }\n },\n footer: {\n help: {\n open: wrapFn()(convertFn(theme.text.message.footer.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.text.message.footer.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.text.message.footer.info)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.text.message.footer.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.text.message.footer.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.text.message.footer.error)),\n close: wrapAnsi16()(39)\n }\n }\n },\n usage: {\n bin: {\n open: wrapFn()(convertFn(theme.text.usage.bin)),\n close: wrapAnsi16()(39)\n },\n command: {\n open: wrapFn()(convertFn(theme.text.usage.command)),\n close: wrapAnsi16()(39)\n },\n subcommand: {\n open: wrapFn()(convertFn(theme.text.usage.subcommand)),\n close: wrapAnsi16()(39)\n },\n options: {\n open: wrapFn()(convertFn(theme.text.usage.options)),\n close: wrapAnsi16()(39)\n },\n params: {\n open: wrapFn()(convertFn(theme.text.usage.params)),\n close: wrapAnsi16()(39)\n },\n description: {\n open: wrapFn()(convertFn(theme.text.usage.description)),\n close: wrapAnsi16()(39)\n }\n }\n },\n border: {\n banner: {\n divider: {\n primary: {\n open: wrapFn()(convertFn(theme.border.banner.divider.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.border.banner.divider.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.border.banner.divider.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n outline: {\n primary: {\n open: wrapFn()(convertFn(theme.border.banner.outline.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.border.banner.outline.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.border.banner.outline.tertiary)),\n close: wrapAnsi16()(39)\n }\n }\n },\n app: {\n divider: {\n primary: {\n open: wrapFn()(convertFn(theme.border.app.divider.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.border.app.divider.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.border.app.divider.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n outline: {\n primary: {\n open: wrapFn()(convertFn(theme.border.app.outline.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.border.app.outline.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.border.app.outline.tertiary)),\n close: wrapAnsi16()(39)\n }\n }\n },\n message: {\n divider: {\n help: {\n open: wrapFn()(convertFn(theme.border.message.divider.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.border.message.divider.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.border.message.divider.info)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.border.message.divider.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.border.message.divider.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.border.message.divider.error)),\n close: wrapAnsi16()(39)\n }\n },\n outline: {\n help: {\n open: wrapFn()(convertFn(theme.border.message.outline.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.border.message.outline.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.border.message.outline.info)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.border.message.outline.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.border.message.outline.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.border.message.outline.error)),\n close: wrapAnsi16()(39)\n }\n }\n }\n }\n };\n}\n\n/**\n * Generates ANSI styles based on the provided context.\n *\n * @param theme - The theme colors configuration.\n * @returns The generated ANSI styles.\n */\nexport function getAnsiStyles(theme: ThemeColorsResolvedConfig): AnsiStyles {\n const output = { ansi16: {}, ansi256: {}, ansi16m: {} } as AnsiStyles;\n\n for (const [key, value] of Object.entries(modifiers) as [\n BaseAnsiStylesKeys,\n [number, number]\n ][]) {\n output.ansi16[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n\n output.ansi256[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n\n output.ansi16m[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n }\n\n for (const [key, value] of Object.entries(colors) as [\n BaseAnsiStylesKeys,\n [number, number]\n ][]) {\n output.ansi16[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n\n output.ansi256[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n\n output.ansi16m[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n }\n\n for (const [key, value] of Object.entries(bgColors) as [\n BaseAnsiStylesKeys,\n [number, number]\n ][]) {\n output.ansi16[key] = {\n open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),\n close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])\n };\n\n output.ansi256[key] = {\n open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),\n close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])\n };\n\n output.ansi16m[key] = {\n open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),\n close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])\n };\n }\n\n output.ansi16.theme = buildThemeAnsiStyles(theme, wrapAnsi16, hexToAnsi);\n output.ansi256.theme = buildThemeAnsiStyles(theme, wrapAnsi256, hexToAnsi256);\n output.ansi16m.theme = buildThemeAnsiStyles(\n theme,\n wrapAnsi16m,\n (code: string) => code\n );\n\n return output;\n}\n"],"mappings":";AAoBA,MAAMA,yBAAyB;AAE/B,MAAaC,YAAY;CACvBC,OAAO,CAAC,GAAG,EAAE;CACbC,MAAM,CAAC,GAAG,GAAG;CACbC,KAAK,CAAC,GAAG,GAAG;CACZC,QAAQ,CAAC,GAAG,GAAG;CACfC,WAAW,CAAC,GAAG,GAAG;CAClBC,UAAU,CAAC,IAAI,GAAG;CAClBC,SAAS,CAAC,GAAG,GAAG;CAChBC,QAAQ,CAAC,GAAG,GAAG;CACfC,eAAe,CAAC,GAAG,GAAE;CACtB;AAED,MAAaC,SAAS;CACpBC,OAAO,CAAC,IAAI,GAAG;CACfC,KAAK,CAAC,IAAI,GAAG;CACbC,OAAO,CAAC,IAAI,GAAG;CACfC,QAAQ,CAAC,IAAI,GAAG;CAChBC,MAAM,CAAC,IAAI,GAAG;CACdC,SAAS,CAAC,IAAI,GAAG;CACjBC,MAAM,CAAC,IAAI,GAAG;CACdC,OAAO,CAAC,IAAI,GAAG;CAGfC,aAAa,CAAC,IAAI,GAAG;CACrBC,MAAM,CAAC,IAA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yB,MAAM,GAAE;GAC7B;AAEDwC,SAAOE,QAAQE,OAAO;GACpBjC,MAAMpC,YAAY,CAACyB,MAAM,GAAG;GAC5BY,OAAOrC,YAAY,CAACyB,MAAM,GAAE;GAC7B;AAEDwC,SAAOG,QAAQC,OAAO;GACpBjC,MAAMpC,YAAY,CAACyB,MAAM,GAAG;GAC5BY,OAAOrC,YAAY,CAACyB,MAAM,GAAE;GAC7B;;AAGH,MAAK,MAAM,CAAC4C,KAAK5C,UAAU6C,OAAOC,QAAQ1F,SAAS,EAG9C;AACHoF,SAAOC,OAAOG,OAAO;GACnBjC,MAAMpC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAG;GAClDY,OAAOrC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAE;GACnD;AAEDwC,SAAOE,QAAQE,OAAO;GACpBjC,MAAMpC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAG;GAClDY,OAAOrC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAE;GACnD;AAEDwC,SAAOG,QAAQC,OAAO;GACpBjC,MAAMpC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAG;GAClDY,OAAOrC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAE;GACnD;;AAGHwC,QAAOC,OAAOpC,QAAQD,qBAAqBC,OAAO9B,YAAY4B,UAAU;AACxEqC,QAAOE,QAAQrC,QAAQD,qBAAqBC,OAAO3B,aAAakB,aAAa;AAC7E4C,QAAOG,QAAQtC,QAAQD,qBACrBC,OACA1B,cACCF,SAAiBA,KACnB;AAED,QAAO+D"}
@@ -0,0 +1,57 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
3
+
4
+ //#region src/helpers/get-default-options.ts
5
+ /**
6
+ * Get the default command options.
7
+ *
8
+ * @param context - The build context.
9
+ * @param command - The command input.
10
+ * @returns The default command options.
11
+ */
12
+ function getDefaultOptions(context, command) {
13
+ return [
14
+ {
15
+ name: "help",
16
+ title: "Help",
17
+ description: "Show help information.",
18
+ alias: ["h", "?"],
19
+ kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean,
20
+ optional: true,
21
+ default: false,
22
+ skipAddingNegative: true
23
+ },
24
+ {
25
+ name: "version",
26
+ title: "Version",
27
+ description: "Show the version of the application.",
28
+ alias: ["v"],
29
+ kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean,
30
+ optional: true,
31
+ default: false,
32
+ skipAddingNegative: true
33
+ },
34
+ {
35
+ name: "no-banner",
36
+ title: "Hide Banner",
37
+ description: "Hide the banner displayed while running the CLI application (will be set to true if running in a CI pipeline).",
38
+ kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean,
39
+ optional: true,
40
+ default: false,
41
+ isNegativeOf: "banner"
42
+ },
43
+ !command.isVirtual && {
44
+ name: "verbose",
45
+ title: "Verbose",
46
+ description: "Enable verbose output.",
47
+ kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean,
48
+ optional: true,
49
+ default: false,
50
+ skipAddingNegative: true
51
+ }
52
+ ].filter(Boolean);
53
+ }
54
+
55
+ //#endregion
56
+ exports.getDefaultOptions = getDefaultOptions;
57
+ //# sourceMappingURL=get-default-options.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-default-options.cjs","names":["ReflectionKind","getDefaultOptions","context","command","name","title","description","alias","kind","boolean","optional","default","skipAddingNegative","isNegativeOf","isVirtual","filter","Boolean"],"sources":["../../src/helpers/get-default-options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandBase, CommandOption } from \"@shell-shock/core\";\nimport type { ScriptPresetContext } from \"../types\";\n\n/**\n * Get the default command options.\n *\n * @param context - The build context.\n * @param command - The command input.\n * @returns The default command options.\n */\nexport function getDefaultOptions(\n context: ScriptPresetContext,\n command: CommandBase\n): CommandOption[] {\n return [\n {\n name: \"help\",\n title: \"Help\",\n description: \"Show help information.\",\n alias: [\"h\", \"?\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"version\",\n title: \"Version\",\n description: \"Show the version of the application.\",\n alias: [\"v\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"no-banner\",\n title: \"Hide Banner\",\n description:\n \"Hide the banner displayed while running the CLI application (will be set to true if running in a CI pipeline).\",\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n isNegativeOf: \"banner\"\n },\n !command.isVirtual && {\n name: \"verbose\",\n title: \"Verbose\",\n description: \"Enable verbose output.\",\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n }\n ].filter(Boolean) as CommandOption[];\n}\n"],"mappings":";;;;;;;;;;;AA6BA,SAAgBC,kBACdC,SACAC,SACiB;AACjB,QAAO;EACL;GACEC,MAAM;GACNC,OAAO;GACPC,aAAa;GACbC,OAAO,CAAC,KAAK,IAAI;GACjBC,MAAMR,gDAAeS;GACrBC,UAAU;GACVC,SAAS;GACTC,oBAAoB;GACrB;EACD;GACER,MAAM;GACNC,OAAO;GACPC,aAAa;GACbC,OAAO,CAAC,IAAI;GACZC,MAAMR,gDAAeS;GACrBC,UAAU;GACVC,SAAS;GACTC,oBAAoB;GACrB;EACD;GACER,MAAM;GACNC,OAAO;GACPC,aACE;GACFE,MAAMR,gDAAeS;GACrBC,UAAU;GACVC,SAAS;GACTE,cAAc;GACf;EACD,CAACV,QAAQW,aAAa;GACpBV,MAAM;GACNC,OAAO;GACPC,aAAa;GACbE,MAAMR,gDAAeS;GACrBC,UAAU;GACVC,SAAS;GACTC,oBAAoB;GACrB;EACF,CAACG,OAAOC,QAAQ"}
@@ -0,0 +1,56 @@
1
+ import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
2
+
3
+ //#region src/helpers/get-default-options.ts
4
+ /**
5
+ * Get the default command options.
6
+ *
7
+ * @param context - The build context.
8
+ * @param command - The command input.
9
+ * @returns The default command options.
10
+ */
11
+ function getDefaultOptions(context, command) {
12
+ return [
13
+ {
14
+ name: "help",
15
+ title: "Help",
16
+ description: "Show help information.",
17
+ alias: ["h", "?"],
18
+ kind: ReflectionKind.boolean,
19
+ optional: true,
20
+ default: false,
21
+ skipAddingNegative: true
22
+ },
23
+ {
24
+ name: "version",
25
+ title: "Version",
26
+ description: "Show the version of the application.",
27
+ alias: ["v"],
28
+ kind: ReflectionKind.boolean,
29
+ optional: true,
30
+ default: false,
31
+ skipAddingNegative: true
32
+ },
33
+ {
34
+ name: "no-banner",
35
+ title: "Hide Banner",
36
+ description: "Hide the banner displayed while running the CLI application (will be set to true if running in a CI pipeline).",
37
+ kind: ReflectionKind.boolean,
38
+ optional: true,
39
+ default: false,
40
+ isNegativeOf: "banner"
41
+ },
42
+ !command.isVirtual && {
43
+ name: "verbose",
44
+ title: "Verbose",
45
+ description: "Enable verbose output.",
46
+ kind: ReflectionKind.boolean,
47
+ optional: true,
48
+ default: false,
49
+ skipAddingNegative: true
50
+ }
51
+ ].filter(Boolean);
52
+ }
53
+
54
+ //#endregion
55
+ export { getDefaultOptions };
56
+ //# sourceMappingURL=get-default-options.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-default-options.mjs","names":["ReflectionKind","getDefaultOptions","context","command","name","title","description","alias","kind","boolean","optional","default","skipAddingNegative","isNegativeOf","isVirtual","filter","Boolean"],"sources":["../../src/helpers/get-default-options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandBase, CommandOption } from \"@shell-shock/core\";\nimport type { ScriptPresetContext } from \"../types\";\n\n/**\n * Get the default command options.\n *\n * @param context - The build context.\n * @param command - The command input.\n * @returns The default command options.\n */\nexport function getDefaultOptions(\n context: ScriptPresetContext,\n command: CommandBase\n): CommandOption[] {\n return [\n {\n name: \"help\",\n title: \"Help\",\n description: \"Show help information.\",\n alias: [\"h\", \"?\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"version\",\n title: \"Version\",\n description: \"Show the version of the application.\",\n alias: [\"v\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"no-banner\",\n title: \"Hide Banner\",\n description:\n \"Hide the banner displayed while running the CLI application (will be set to true if running in a CI pipeline).\",\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n isNegativeOf: \"banner\"\n },\n !command.isVirtual && {\n name: \"verbose\",\n title: \"Verbose\",\n description: \"Enable verbose output.\",\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n }\n ].filter(Boolean) as CommandOption[];\n}\n"],"mappings":";;;;;;;;;;AA6BA,SAAgBC,kBACdC,SACAC,SACiB;AACjB,QAAO;EACL;GACEC,MAAM;GACNC,OAAO;GACPC,aAAa;GACbC,OAAO,CAAC,KAAK,IAAI;GACjBC,MAAMR,eAAeS;GACrBC,UAAU;GACVC,SAAS;GACTC,oBAAoB;GACrB;EACD;GACER,MAAM;GACNC,OAAO;GACPC,aAAa;GACbC,OAAO,CAAC,IAAI;GACZC,MAAMR,eAAeS;GACrBC,UAAU;GACVC,SAAS;GACTC,oBAAoB;GACrB;EACD;GACER,MAAM;GACNC,OAAO;GACPC,aACE;GACFE,MAAMR,eAAeS;GACrBC,UAAU;GACVC,SAAS;GACTE,cAAc;GACf;EACD,CAACV,QAAQW,aAAa;GACpBV,MAAM;GACNC,OAAO;GACPC,aAAa;GACbE,MAAMR,eAAeS;GACrBC,UAAU;GACVC,SAAS;GACTC,oBAAoB;GACrB;EACF,CAACG,OAAOC,QAAQ"}