@shell-shock/preset-script 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.
Files changed (61) hide show
  1. package/README.md +2 -2
  2. package/dist/components/args-parser-logic.d.cts +7 -7
  3. package/dist/components/args-parser-logic.d.cts.map +1 -1
  4. package/dist/components/bin-entry.cjs +0 -1
  5. package/dist/components/bin-entry.cjs.map +1 -1
  6. package/dist/components/bin-entry.d.cts.map +1 -1
  7. package/dist/components/bin-entry.d.mts.map +1 -1
  8. package/dist/components/bin-entry.mjs +0 -1
  9. package/dist/components/bin-entry.mjs.map +1 -1
  10. package/dist/components/command-entry.d.cts +4 -4
  11. package/dist/components/command-entry.d.mts +4 -4
  12. package/dist/components/command-entry.d.mts.map +1 -1
  13. package/dist/components/command-router.cjs +5 -7
  14. package/dist/components/command-router.cjs.map +1 -1
  15. package/dist/components/command-router.mjs +5 -7
  16. package/dist/components/command-router.mjs.map +1 -1
  17. package/dist/components/console-builtin.cjs +314 -82
  18. package/dist/components/console-builtin.cjs.map +1 -1
  19. package/dist/components/console-builtin.d.cts +12 -2
  20. package/dist/components/console-builtin.d.cts.map +1 -1
  21. package/dist/components/console-builtin.d.mts +12 -2
  22. package/dist/components/console-builtin.d.mts.map +1 -1
  23. package/dist/components/console-builtin.mjs +315 -84
  24. package/dist/components/console-builtin.mjs.map +1 -1
  25. package/dist/components/help.cjs +35 -23
  26. package/dist/components/help.cjs.map +1 -1
  27. package/dist/components/help.d.cts +19 -11
  28. package/dist/components/help.d.cts.map +1 -1
  29. package/dist/components/help.d.mts +19 -11
  30. package/dist/components/help.d.mts.map +1 -1
  31. package/dist/components/help.mjs +36 -24
  32. package/dist/components/help.mjs.map +1 -1
  33. package/dist/components/index.cjs +1 -0
  34. package/dist/components/index.d.cts +3 -3
  35. package/dist/components/index.d.mts +3 -3
  36. package/dist/components/index.mjs +2 -2
  37. package/dist/components/utils-builtin.cjs +18 -16
  38. package/dist/components/utils-builtin.cjs.map +1 -1
  39. package/dist/components/utils-builtin.d.cts +7 -7
  40. package/dist/components/utils-builtin.d.cts.map +1 -1
  41. package/dist/components/utils-builtin.d.mts +7 -7
  42. package/dist/components/utils-builtin.d.mts.map +1 -1
  43. package/dist/components/utils-builtin.mjs +18 -16
  44. package/dist/components/utils-builtin.mjs.map +1 -1
  45. package/dist/components/virtual-command-entry.d.cts +3 -3
  46. package/dist/components/virtual-command-entry.d.cts.map +1 -1
  47. package/dist/helpers/ansi-utils.cjs +74 -10
  48. package/dist/helpers/ansi-utils.cjs.map +1 -1
  49. package/dist/helpers/ansi-utils.mjs +74 -10
  50. package/dist/helpers/ansi-utils.mjs.map +1 -1
  51. package/dist/helpers/get-default-options.cjs +20 -0
  52. package/dist/helpers/get-default-options.cjs.map +1 -1
  53. package/dist/helpers/get-default-options.mjs +20 -0
  54. package/dist/helpers/get-default-options.mjs.map +1 -1
  55. package/dist/index.cjs +97 -75
  56. package/dist/index.cjs.map +1 -1
  57. package/dist/index.d.cts.map +1 -1
  58. package/dist/index.d.mts.map +1 -1
  59. package/dist/index.mjs +99 -77
  60. package/dist/index.mjs.map +1 -1
  61. package/package.json +10 -10
package/dist/index.cjs CHANGED
@@ -12,7 +12,6 @@ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
12
12
  let __alloy_js_core = require("@alloy-js/core");
13
13
  let __alloy_js_typescript = require("@alloy-js/typescript");
14
14
  let __powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
15
- let __shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
16
15
  let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
17
16
  let __shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
18
17
  __shell_shock_plugin_theme = require_rolldown_runtime.__toESM(__shell_shock_plugin_theme);
@@ -49,96 +48,119 @@ const plugin = (options = {}) => {
49
48
  async handler() {
50
49
  const _self$ = this;
51
50
  this.debug("Rendering entrypoint modules for the Shell Shock `script` preset.");
52
- const commands = this.inputs.map((input) => (0, __shell_shock_core_plugin_utils.getCommandTree)(this, input.path.segments)).filter(Boolean);
53
51
  return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_bin_entry.BinEntry, {
54
52
  builtinImports: {
55
53
  console: [
56
54
  "divider",
57
55
  "writeLine",
58
- "colors"
56
+ "colors",
57
+ "banner",
58
+ "help"
59
59
  ],
60
60
  utils: ["getArgs"]
61
61
  },
62
62
  get children() {
63
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
64
- get when() {
65
- return (0, __alloy_js_core_jsx_runtime.memo)(() => !!_self$.commands)() && Object.keys(_self$.commands).length > 0;
66
- },
67
- get children() {
68
- return [
69
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
70
- "const": true,
71
- name: "args",
72
- type: "string[]",
73
- initializer: __alloy_js_core.code`getArgs();`
74
- }),
75
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
76
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
77
- path: [],
78
- get commands() {
79
- return _self$.commands ?? {};
80
- }
81
- }),
82
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
83
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
84
- (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
85
- writeLine("");
86
- writeLine(colors.text.heading.primary("${/(?:cli|command-line|command line)\s+(?:application|app)?$/.test((0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(_self$).toLowerCase()) ? (0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(_self$) : `${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(_self$)} Command-Line Application`} v${_self$.packageJson.version}"));
87
- writeLine("");
88
- writeLine(colors.text.body.primary("${(0, __shell_shock_core_plugin_utils_context_helpers.getAppDescription)(_self$)}"));
89
- writeLine("");
90
- divider({ style: "primary" });
91
- writeLine("");
92
- writeLine("");`),
93
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
94
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
95
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
96
- get each() {
97
- return Object.values(commands);
98
- },
99
- doubleHardline: true,
100
- joiner: __alloy_js_core.code`
101
- writeLine("");
102
- divider({ style: "secondary" });
103
- writeLine("");
63
+ return [
64
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
65
+ get when() {
66
+ return Object.keys(_self$.commands).length > 0;
67
+ },
68
+ get children() {
69
+ return [
70
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
71
+ "const": true,
72
+ name: "args",
73
+ type: "string[]",
74
+ initializer: __alloy_js_core.code`getArgs();`
75
+ }),
76
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
77
+ (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
78
+ path: [],
79
+ get commands() {
80
+ return _self$.commands ?? {};
81
+ }
82
+ }),
83
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
84
+ ];
85
+ }
86
+ }),
87
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
88
+ __alloy_js_core.code`
104
89
  writeLine("");
105
- `,
106
- children: (child) => [
107
- (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
108
- writeLine("");
109
- writeLine(colors.text.heading.secondary("${child.title}"));
90
+ banner();
91
+ writeLine(""); `,
92
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
93
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
94
+ __alloy_js_core.code`writeLine(colors.text.heading.secondary("Global Options:"));`,
95
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
96
+ (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_help.HelpOptions, { get options() {
97
+ return _self$.options;
98
+ } }),
99
+ __alloy_js_core.code`writeLine(""); `,
100
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
101
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
102
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
103
+ get when() {
104
+ return Object.keys(_self$.commands).length > 0;
105
+ },
106
+ get children() {
107
+ return [
108
+ __alloy_js_core.code`writeLine(colors.text.body.secondary("The following commands are available:"));
109
+ writeLine(""); `,
110
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
111
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
112
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
113
+ get each() {
114
+ return Object.values(_self$.commands);
115
+ },
116
+ doubleHardline: true,
117
+ joiner: __alloy_js_core.code`writeLine(""); `,
118
+ ender: __alloy_js_core.code`writeLine(""); `,
119
+ children: (child) => [
120
+ (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
121
+ writeLine(colors.text.heading.primary("${child.title} ${child.isVirtual ? "" : "Command"}"));
110
122
  writeLine("");
111
123
  writeLine(colors.text.body.secondary("${child.description}"));
112
124
  writeLine("");
113
- writeLine("");
114
125
  `),
115
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
116
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_help.Help, {
117
- command: child,
118
- indent: 2
119
- })
120
- ]
121
- })
122
- ];
123
- }
124
- });
126
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
127
+ (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_help.Help, {
128
+ command: child,
129
+ indent: 2
130
+ }),
131
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
132
+ ]
133
+ }),
134
+ (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`help("Running a specific command with the help flag (via: '${(0, __shell_shock_core_plugin_utils_context_helpers.getAppBin)(_self$)} <specific command> --help') will provide additional information that is specific to that command.");
135
+ writeLine("");`)
136
+ ];
137
+ }
138
+ })
139
+ ];
125
140
  }
126
- }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
127
- get each() {
128
- return Object.values(commands);
141
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
142
+ get when() {
143
+ return Object.values(_self$.commands).length > 0;
129
144
  },
130
- doubleHardline: true,
131
- children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
132
- get when() {
133
- return child.isVirtual;
134
- },
135
- get fallback() {
136
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
137
- },
138
- get children() {
139
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
140
- }
141
- })
145
+ get children() {
146
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
147
+ get each() {
148
+ return Object.values(_self$.commands);
149
+ },
150
+ doubleHardline: true,
151
+ children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
152
+ get when() {
153
+ return child.isVirtual;
154
+ },
155
+ get fallback() {
156
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
157
+ },
158
+ get children() {
159
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
160
+ }
161
+ })
162
+ });
163
+ }
142
164
  })]);
143
165
  }
144
166
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["code","For","Show","VarDeclaration","render","getCommandTree","getAppDescription","getAppTitle","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","commands","inputs","map","input","path","segments","filter","Boolean","builtinImports","console","utils","children","when","_$memo","Object","keys","length","type","initializer","_$createIntrinsic","test","toLowerCase","packageJson","version","each","values","doubleHardline","joiner","child","title","description","command","indent","isVirtual","fallback"],"sources":["../src/index.tsx"],"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 { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { getCommandTree } from \"@shell-shock/core/plugin-utils\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n const commands = this.inputs\n .map(input => getCommandTree(this, input.path.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\"],\n utils: [\"getArgs\"]\n }}>\n <Show\n when={this.commands && Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n getAppTitle(this).toLowerCase()\n )\n ? getAppTitle(this)\n : `${getAppTitle(this)} Command-Line Application`\n } v${this.packageJson.version}\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${getAppDescription(\n this\n )}\"));\n writeLine(\"\");\n divider({ style: \"primary\" });\n writeLine(\"\");\n writeLine(\"\");`}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`\n writeLine(\"\");\n divider({ style: \"secondary\" });\n writeLine(\"\");\n writeLine(\"\");\n `}>\n {child => (\n <>\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"${child.title}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n </>\n )}\n </For>\n </Show>\n </BinEntry>\n <For each={Object.values(commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAaiB,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;0CACC,EACJV,OAAOU,QAAQV,OAChB,CAAC;EACF;GACEW,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,uEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SAAKN,MACH,kEACD;AAED,wDACE,MAAI,kDAEDP,+CAAY,EAAA,CAAA,mDACZF,mDAAc,EAAA,CAAA,CAEnB,CAAC;;GAEJ;EACD;GACEO,MAAM;GACNQ,SAAS;IACPE,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKV,MACH,oEACD;KAED,MAAMW,WAAW,KAAKC,OACnBC,KAAIC,8DAAwB,MAAMA,MAAMC,KAAKC,SAAS,CAAC,CACvDC,OAAOC,QAAyB;AAEnC,yDACE,MAAI,kDAED9B,uCAAQ;MACP+B,gBAAgB;OACdC,SAAS;QAAC;QAAW;QAAa;QAAS;OAC3CC,OAAO,CAAC,UAAS;OAClB;MAAA,IAAAC,WAAA;AAAA,+DACAzC,sBAAI;QAAA,I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AA,IAAAjB,WAAA;AAAA,gEACrC5B,8DAAmB,EAACgD,SAASH,OAAK,CAAA;;OAAA,CAAA;MAEtC,CAAA,CAGP,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAe3C"}
1
+ {"version":3,"file":"index.cjs","names":["code","For","Show","VarDeclaration","render","getAppBin","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","HelpOptions","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","builtinImports","console","utils","children","when","Object","keys","commands","length","type","initializer","_$createIntrinsic","path","each","values","doubleHardline","joiner","ender","child","_$memo","title","isVirtual","description","command","indent","fallback"],"sources":["../src/index.tsx"],"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 { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { getAppBin } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help, HelpOptions } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\", \"banner\", \"help\"],\n utils: [\"getArgs\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n {code`\n writeLine(\"\");\n banner();\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n {code`writeLine(colors.text.heading.secondary(\"Global Options:\"));`}\n <hbr />\n <HelpOptions options={this.options} />\n {code`writeLine(\"\"); `}\n <hbr />\n <hbr />\n <Show when={Object.keys(this.commands).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(this.commands)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(this)} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAagB,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;0CACC,EACJX,OAAOW,QAAQX,OAChB,CAAC;EACF;GACEY,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,uEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SAAKN,MACH,kEACD;AAED,wDACE,MAAI,kDAEDP,+CAAY,EAAA,CAAA,mDACZH,mDAAc,EAAA,CAAA,CAEnB,CAAC;;GAEJ;EACD;GACEQ,MAAM;GACNQ,SAAS;IACPE,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKV,MACH,oEACD;AAED,yDACE,MAAI,kDAEDb,uCAAQ;MACPwB,gBAAgB;OACdC,SAAS;QAAC;QAAW;QAAa;QAAU;QAAU;QAAO;OAC7DC,OAAO,CAAC,UAAS;OAClB;MAAA,IAAAC,WAAA;AAAA,cAAA;yDACAhC,sBAAI;SAA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EFvD,oBAAI,6HAAuE8B,OAAM,CAAA;kCACnE;WAAA;;SAAA,CAAA;QAAA;;MAAA,CAAA,mDAGlB5B,sBAAI;MAAA,IAACiC,OAAI;AAAA,cAAEC,OAAOS,OAAOf,OAAKQ,SAAS,CAACC,SAAS;;MAAC,IAAAL,WAAA;AAAA,+DAChDjC,qBAAG;QAAA,IAAC2C,OAAI;AAAA,gBAAER,OAAOS,OAAOf,OAAKQ,SAAS;;QAAEQ,gBAAc;QAAAZ,WACpDe,2DACE/C,sBAAI;SAAA,IACHiC,OAAI;AAAA,iBAAEc,MAAMG;;SAAS,IACrBI,WAAQ;AAAA,kEAAGhD,+CAAY,EAAC8C,SAASL,OAAK,CAAA;;SAAA,IAAAf,WAAA;AAAA,kEACrCpB,8DAAmB,EAACwC,SAASL,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAejC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA0CA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GAkIZ,MAlIY,CAkIL,QAlIK,CAAA,EAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GA2HZ,MA3HY,CA2HL,QA3HK,CAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA0CA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GAkIZ,MAlIY,CAkIL,QAlIK,CAAA,EAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GA2HZ,MA3HY,CA2HL,QA3HK,CAAA,EAAA"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BinEntry } from "./components/bin-entry.mjs";
2
- import { Help } from "./components/help.mjs";
2
+ import { Help, HelpOptions } from "./components/help.mjs";
3
3
  import { CommandRouter } from "./components/command-router.mjs";
4
4
  import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
5
5
  import { CommandEntry } from "./components/command-entry.mjs";
@@ -10,8 +10,7 @@ import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runti
10
10
  import { For, Show, code } from "@alloy-js/core";
11
11
  import { VarDeclaration } from "@alloy-js/typescript";
12
12
  import { render } from "@powerlines/plugin-alloy/render";
13
- import { getCommandTree } from "@shell-shock/core/plugin-utils";
14
- import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils/context-helpers";
13
+ import { getAppBin } from "@shell-shock/core/plugin-utils/context-helpers";
15
14
  import theme from "@shell-shock/plugin-theme";
16
15
 
17
16
  //#region src/index.tsx
@@ -46,96 +45,119 @@ const plugin = (options = {}) => {
46
45
  async handler() {
47
46
  const _self$ = this;
48
47
  this.debug("Rendering entrypoint modules for the Shell Shock `script` preset.");
49
- const commands = this.inputs.map((input) => getCommandTree(this, input.path.segments)).filter(Boolean);
50
48
  return render(this, [createComponent(BinEntry, {
51
49
  builtinImports: {
52
50
  console: [
53
51
  "divider",
54
52
  "writeLine",
55
- "colors"
53
+ "colors",
54
+ "banner",
55
+ "help"
56
56
  ],
57
57
  utils: ["getArgs"]
58
58
  },
59
59
  get children() {
60
- return createComponent(Show, {
61
- get when() {
62
- return memo(() => !!_self$.commands)() && Object.keys(_self$.commands).length > 0;
63
- },
64
- get children() {
65
- return [
66
- createComponent(VarDeclaration, {
67
- "const": true,
68
- name: "args",
69
- type: "string[]",
70
- initializer: code`getArgs();`
71
- }),
72
- createIntrinsic("hbr", {}),
73
- createComponent(CommandRouter, {
74
- path: [],
75
- get commands() {
76
- return _self$.commands ?? {};
77
- }
78
- }),
79
- createIntrinsic("hbr", {}),
80
- createIntrinsic("hbr", {}),
81
- memo(() => code`
82
- writeLine("");
83
- writeLine(colors.text.heading.primary("${/(?:cli|command-line|command line)\s+(?:application|app)?$/.test(getAppTitle(_self$).toLowerCase()) ? getAppTitle(_self$) : `${getAppTitle(_self$)} Command-Line Application`} v${_self$.packageJson.version}"));
84
- writeLine("");
85
- writeLine(colors.text.body.primary("${getAppDescription(_self$)}"));
86
- writeLine("");
87
- divider({ style: "primary" });
88
- writeLine("");
89
- writeLine("");`),
90
- createIntrinsic("hbr", {}),
91
- createIntrinsic("hbr", {}),
92
- createComponent(For, {
93
- get each() {
94
- return Object.values(commands);
95
- },
96
- doubleHardline: true,
97
- joiner: code`
98
- writeLine("");
99
- divider({ style: "secondary" });
100
- writeLine("");
60
+ return [
61
+ createComponent(Show, {
62
+ get when() {
63
+ return Object.keys(_self$.commands).length > 0;
64
+ },
65
+ get children() {
66
+ return [
67
+ createComponent(VarDeclaration, {
68
+ "const": true,
69
+ name: "args",
70
+ type: "string[]",
71
+ initializer: code`getArgs();`
72
+ }),
73
+ createIntrinsic("hbr", {}),
74
+ createComponent(CommandRouter, {
75
+ path: [],
76
+ get commands() {
77
+ return _self$.commands ?? {};
78
+ }
79
+ }),
80
+ createIntrinsic("hbr", {})
81
+ ];
82
+ }
83
+ }),
84
+ createIntrinsic("hbr", {}),
85
+ code`
101
86
  writeLine("");
102
- `,
103
- children: (child) => [
104
- memo(() => code`
105
- writeLine("");
106
- writeLine(colors.text.heading.secondary("${child.title}"));
87
+ banner();
88
+ writeLine(""); `,
89
+ createIntrinsic("hbr", {}),
90
+ createIntrinsic("hbr", {}),
91
+ code`writeLine(colors.text.heading.secondary("Global Options:"));`,
92
+ createIntrinsic("hbr", {}),
93
+ createComponent(HelpOptions, { get options() {
94
+ return _self$.options;
95
+ } }),
96
+ code`writeLine(""); `,
97
+ createIntrinsic("hbr", {}),
98
+ createIntrinsic("hbr", {}),
99
+ createComponent(Show, {
100
+ get when() {
101
+ return Object.keys(_self$.commands).length > 0;
102
+ },
103
+ get children() {
104
+ return [
105
+ code`writeLine(colors.text.body.secondary("The following commands are available:"));
106
+ writeLine(""); `,
107
+ createIntrinsic("hbr", {}),
108
+ createIntrinsic("hbr", {}),
109
+ createComponent(For, {
110
+ get each() {
111
+ return Object.values(_self$.commands);
112
+ },
113
+ doubleHardline: true,
114
+ joiner: code`writeLine(""); `,
115
+ ender: code`writeLine(""); `,
116
+ children: (child) => [
117
+ memo(() => code`
118
+ writeLine(colors.text.heading.primary("${child.title} ${child.isVirtual ? "" : "Command"}"));
107
119
  writeLine("");
108
120
  writeLine(colors.text.body.secondary("${child.description}"));
109
121
  writeLine("");
110
- writeLine("");
111
122
  `),
112
- createIntrinsic("hbr", {}),
113
- createComponent(Help, {
114
- command: child,
115
- indent: 2
116
- })
117
- ]
118
- })
119
- ];
120
- }
121
- });
123
+ createIntrinsic("hbr", {}),
124
+ createComponent(Help, {
125
+ command: child,
126
+ indent: 2
127
+ }),
128
+ createIntrinsic("hbr", {})
129
+ ]
130
+ }),
131
+ memo(() => code`help("Running a specific command with the help flag (via: '${getAppBin(_self$)} <specific command> --help') will provide additional information that is specific to that command.");
132
+ writeLine("");`)
133
+ ];
134
+ }
135
+ })
136
+ ];
122
137
  }
123
- }), createComponent(For, {
124
- get each() {
125
- return Object.values(commands);
138
+ }), createComponent(Show, {
139
+ get when() {
140
+ return Object.values(_self$.commands).length > 0;
126
141
  },
127
- doubleHardline: true,
128
- children: (child) => createComponent(Show, {
129
- get when() {
130
- return child.isVirtual;
131
- },
132
- get fallback() {
133
- return createComponent(CommandEntry, { command: child });
134
- },
135
- get children() {
136
- return createComponent(VirtualCommandEntry, { command: child });
137
- }
138
- })
142
+ get children() {
143
+ return createComponent(For, {
144
+ get each() {
145
+ return Object.values(_self$.commands);
146
+ },
147
+ doubleHardline: true,
148
+ children: (child) => createComponent(Show, {
149
+ get when() {
150
+ return child.isVirtual;
151
+ },
152
+ get fallback() {
153
+ return createComponent(CommandEntry, { command: child });
154
+ },
155
+ get children() {
156
+ return createComponent(VirtualCommandEntry, { command: child });
157
+ }
158
+ })
159
+ });
160
+ }
139
161
  })]);
140
162
  }
141
163
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","getCommandTree","getAppDescription","getAppTitle","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","commands","inputs","map","input","path","segments","filter","Boolean","builtinImports","console","utils","children","when","_$memo","Object","keys","length","type","initializer","_$createIntrinsic","test","toLowerCase","packageJson","version","each","values","doubleHardline","joiner","child","title","description","command","indent","isVirtual","fallback"],"sources":["../src/index.tsx"],"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 { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { getCommandTree } from \"@shell-shock/core/plugin-utils\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n const commands = this.inputs\n .map(input => getCommandTree(this, input.path.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\"],\n utils: [\"getArgs\"]\n }}>\n <Show\n when={this.commands && Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n getAppTitle(this).toLowerCase()\n )\n ? getAppTitle(this)\n : `${getAppTitle(this)} Command-Line Application`\n } v${this.packageJson.version}\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${getAppDescription(\n this\n )}\"));\n writeLine(\"\");\n divider({ style: \"primary\" });\n writeLine(\"\");\n writeLine(\"\");`}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`\n writeLine(\"\");\n divider({ style: \"secondary\" });\n writeLine(\"\");\n writeLine(\"\");\n `}>\n {child => (\n <>\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"${child.title}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n </>\n )}\n </For>\n </Show>\n </BinEntry>\n <For each={Object.values(commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0CA,MAAaiB,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;EACLV,MAAM,EACJA,OAAOU,QAAQV,OAChB,CAAC;EACF;GACEW,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,uEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;A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AAA,OAAA,EAAA,CAAA;UAAAA,gBAAA,OAAA,EAAA,CAAA;UAAAvB,gBAGZ3B,KAAG;WAAA,IACFuD,OAAI;AAAA,mBAAEV,OAAOW,OAAOzB,SAAS;;WAC7B0B,gBAAc;WACdC,QAAQ3D,IAAI;;;;;;WAKf2C,WACIiB,UAAK;YAAAf,WAED7C,IAAI;;2DAE8B4D,MAAMC,MAAK;;wDAEdD,MAAME,YAAW;;;kBAGxD;YAAAX,gBAAA,OAAA,EAAA,CAAA;YAAAvB,gBAEQf,MAAI;aAACkD,SAASH;aAAOI,QAAQ;aAAC,CAAA;YAAA;WAElC,CAAA;UAAA;;QAAA,CAAA;;MAAA,CAAA,EAAApC,gBAIN3B,KAAG;MAAA,IAACuD,OAAI;AAAA,cAAEV,OAAOW,OAAOzB,SAAS;;MAAE0B,gBAAc;MAAAf,WAC/CiB,UAAKhC,gBACH1B,MAAI;OAAA,IACH0C,OAAI;AAAA,eAAEgB,MAAMK;;OAAS,IACrBC,WAAQ;AAAA,eAAAtC,gBAAGlB,cAAY,EAACqD,SAASH,OAAK,CAAA;;OAAA,IAAAjB,WAAA;AAAA,eAAAf,gBACrCb,qBAAmB,EAACgD,SAASH,OAAK,CAAA;;OAAA,CAAA;MAEtC,CAAA,CAGP,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAe3C"}
1
+ {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","getAppBin","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","HelpOptions","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","builtinImports","console","utils","children","when","Object","keys","commands","length","type","initializer","_$createIntrinsic","path","each","values","doubleHardline","joiner","ender","child","_$memo","title","isVirtual","description","command","indent","fallback"],"sources":["../src/index.tsx"],"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 { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { getAppBin } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help, HelpOptions } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\", \"banner\", \"help\"],\n utils: [\"getArgs\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n {code`\n writeLine(\"\");\n banner();\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n {code`writeLine(colors.text.heading.secondary(\"Global Options:\"));`}\n <hbr />\n <HelpOptions options={this.options} />\n {code`writeLine(\"\"); `}\n <hbr />\n <hbr />\n <Show when={Object.keys(this.commands).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(this.commands)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(this)} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;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HiC,OAAI;AAAA,iBAAEc,MAAMG;;SAAS,IACrBI,WAAQ;AAAA,iBAAA7B,gBAAGnB,cAAY,EAAC8C,SAASL,OAAK,CAAA;;SAAA,IAAAf,WAAA;AAAA,iBAAAP,gBACrCb,qBAAmB,EAACwC,SAASL,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAejC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/preset-script",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "A Shell Shock preset that generates a fully-featured script application.",
6
6
  "repository": {
@@ -251,23 +251,23 @@
251
251
  "dependencies": {
252
252
  "@alloy-js/core": "0.22.0",
253
253
  "@alloy-js/typescript": "^0.22.0",
254
- "@powerlines/deepkit": "^0.6.43",
255
- "@powerlines/plugin-alloy": "^0.20.6",
256
- "@powerlines/plugin-plugin": "^0.12.214",
257
- "@shell-shock/core": "^0.4.0",
258
- "@shell-shock/plugin-theme": "^0.0.8",
254
+ "@powerlines/deepkit": "^0.6.46",
255
+ "@powerlines/plugin-alloy": "^0.20.9",
256
+ "@powerlines/plugin-plugin": "^0.12.217",
257
+ "@shell-shock/core": "^0.4.2",
258
+ "@shell-shock/plugin-theme": "^0.0.10",
259
259
  "@stryke/path": "^0.26.4",
260
260
  "@stryke/string-format": "^0.13.7",
261
261
  "@stryke/type-checks": "^0.5.23",
262
262
  "defu": "^6.1.4",
263
- "powerlines": "^0.38.30",
263
+ "powerlines": "^0.38.33",
264
264
  "@stryke/helpers": "0.9.40"
265
265
  },
266
266
  "devDependencies": {
267
267
  "@babel/core": "^7.29.0",
268
- "@powerlines/plugin-alloy": "^0.20.6",
269
- "@types/node": "^22.19.7"
268
+ "@powerlines/plugin-alloy": "^0.20.9",
269
+ "@types/node": "^22.19.8"
270
270
  },
271
271
  "publishConfig": { "access": "public" },
272
- "gitHead": "ad8f1104e63a42de787eb5c5ec5c57e27f8a682e"
272
+ "gitHead": "93f7eadb6fb5670226a117c04e7e8b505554d76d"
273
273
  }