@shell-shock/preset-script 0.3.2 → 0.3.3
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/dist/components/banner-function-declaration.cjs +68 -0
- package/dist/components/banner-function-declaration.cjs.map +1 -0
- package/dist/components/banner-function-declaration.d.cts +19 -0
- package/dist/components/banner-function-declaration.d.cts.map +1 -0
- package/dist/components/banner-function-declaration.d.mts +19 -0
- package/dist/components/banner-function-declaration.d.mts.map +1 -0
- package/dist/components/banner-function-declaration.mjs +67 -0
- package/dist/components/banner-function-declaration.mjs.map +1 -0
- package/dist/components/bin-entry.cjs +1 -1
- package/dist/components/bin-entry.mjs +1 -1
- package/dist/components/command-entry.cjs +28 -18
- package/dist/components/command-entry.cjs.map +1 -1
- package/dist/components/command-entry.d.cts +5 -5
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +4 -4
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +27 -17
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +8 -29
- package/dist/components/command-router.cjs.map +1 -1
- package/dist/components/command-router.mjs +8 -29
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/console-builtin.cjs +2 -58
- package/dist/components/console-builtin.cjs.map +1 -1
- package/dist/components/console-builtin.d.cts +3 -21
- package/dist/components/console-builtin.d.cts.map +1 -1
- package/dist/components/console-builtin.d.mts +3 -21
- package/dist/components/console-builtin.d.mts.map +1 -1
- package/dist/components/console-builtin.mjs +4 -59
- package/dist/components/console-builtin.mjs.map +1 -1
- package/dist/components/help.cjs +72 -6
- package/dist/components/help.cjs.map +1 -1
- package/dist/components/help.d.cts +20 -6
- package/dist/components/help.d.cts.map +1 -1
- package/dist/components/help.d.mts +15 -1
- package/dist/components/help.d.mts.map +1 -1
- package/dist/components/help.mjs +72 -7
- package/dist/components/help.mjs.map +1 -1
- package/dist/components/index.cjs +3 -8
- package/dist/components/index.d.cts +4 -4
- package/dist/components/index.d.mts +4 -4
- package/dist/components/index.mjs +4 -4
- package/dist/components/utils-builtin.cjs +1 -1
- package/dist/components/utils-builtin.d.mts +7 -7
- package/dist/components/utils-builtin.mjs +1 -1
- package/dist/components/virtual-command-entry.cjs +3 -3
- package/dist/components/virtual-command-entry.cjs.map +1 -1
- package/dist/components/virtual-command-entry.d.cts +1 -1
- package/dist/components/virtual-command-entry.d.mts +3 -3
- package/dist/components/virtual-command-entry.mjs +3 -3
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/index.cjs +18 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +19 -52
- package/dist/index.mjs.map +1 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/package.json +18 -19
- package/dist/components/args-parser-logic.cjs +0 -678
- package/dist/components/args-parser-logic.cjs.map +0 -1
- package/dist/components/args-parser-logic.d.cts +0 -45
- package/dist/components/args-parser-logic.d.cts.map +0 -1
- package/dist/components/args-parser-logic.d.mts +0 -45
- package/dist/components/args-parser-logic.d.mts.map +0 -1
- package/dist/components/args-parser-logic.mjs +0 -672
- package/dist/components/args-parser-logic.mjs.map +0 -1
package/dist/components/help.cjs
CHANGED
|
@@ -3,9 +3,10 @@ const require_contexts_theme = require('../contexts/theme.cjs');
|
|
|
3
3
|
require('../contexts/index.cjs');
|
|
4
4
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
5
|
let __alloy_js_core = require("@alloy-js/core");
|
|
6
|
-
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
7
6
|
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
7
|
+
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
8
8
|
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
9
|
+
let __shell_shock_core_components_usage = require("@shell-shock/core/components/usage");
|
|
9
10
|
let __shell_shock_core_plugin_utils_reflect = require("@shell-shock/core/plugin-utils/reflect");
|
|
10
11
|
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
11
12
|
let __stryke_string_format_snake_case = require("@stryke/string-format/snake-case");
|
|
@@ -23,12 +24,18 @@ function HelpUsage(props) {
|
|
|
23
24
|
return Object.keys(context.config.bin);
|
|
24
25
|
},
|
|
25
26
|
hardline: true,
|
|
26
|
-
children: (bin) => [
|
|
27
|
+
children: (bin) => [
|
|
28
|
+
__alloy_js_core.code`
|
|
27
29
|
writeLine(
|
|
28
|
-
colors.text.body.primary(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
colors.text.body.primary("`,
|
|
31
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_core_components_usage.Usage, {
|
|
32
|
+
bin,
|
|
33
|
+
command
|
|
34
|
+
}),
|
|
35
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`"), { padding: ${theme.padding.app * indent} }
|
|
36
|
+
);`),
|
|
37
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
38
|
+
]
|
|
32
39
|
});
|
|
33
40
|
}
|
|
34
41
|
/**
|
|
@@ -133,10 +140,69 @@ function Help(props) {
|
|
|
133
140
|
})
|
|
134
141
|
];
|
|
135
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* A component that generates the invocation of the `help` function for a command.
|
|
145
|
+
*/
|
|
146
|
+
function HelpInvoke(props) {
|
|
147
|
+
const { options, commands } = props;
|
|
148
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
149
|
+
return [
|
|
150
|
+
__alloy_js_core.code`
|
|
151
|
+
writeLine("");
|
|
152
|
+
banner();
|
|
153
|
+
writeLine(""); `,
|
|
154
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
155
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
156
|
+
__alloy_js_core.code`writeLine(colors.bold(colors.text.heading.secondary("Global Options:")));`,
|
|
157
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
158
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(HelpOptions, { options }),
|
|
159
|
+
__alloy_js_core.code`writeLine(""); `,
|
|
160
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
161
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
162
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
163
|
+
get when() {
|
|
164
|
+
return Object.keys(commands).length > 0;
|
|
165
|
+
},
|
|
166
|
+
get children() {
|
|
167
|
+
return [
|
|
168
|
+
__alloy_js_core.code`writeLine(colors.text.body.secondary("The following commands are available:"));
|
|
169
|
+
writeLine(""); `,
|
|
170
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
171
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
172
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
173
|
+
get each() {
|
|
174
|
+
return Object.values(commands);
|
|
175
|
+
},
|
|
176
|
+
doubleHardline: true,
|
|
177
|
+
joiner: __alloy_js_core.code`writeLine(""); `,
|
|
178
|
+
ender: __alloy_js_core.code`writeLine(""); `,
|
|
179
|
+
children: (child) => [
|
|
180
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
|
|
181
|
+
writeLine(colors.text.heading.primary("${child.title} ${child.isVirtual ? "" : "Command"}"));
|
|
182
|
+
writeLine("");
|
|
183
|
+
writeLine(colors.text.body.secondary("${child.description}"));
|
|
184
|
+
writeLine("");
|
|
185
|
+
`),
|
|
186
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
187
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(Help, {
|
|
188
|
+
command: child,
|
|
189
|
+
indent: 2
|
|
190
|
+
}),
|
|
191
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
192
|
+
]
|
|
193
|
+
}),
|
|
194
|
+
(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)(context)} <specific command> --help') will provide additional information that is specific to that command.");
|
|
195
|
+
writeLine("");`)
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
];
|
|
200
|
+
}
|
|
136
201
|
|
|
137
202
|
//#endregion
|
|
138
203
|
exports.Help = Help;
|
|
139
204
|
exports.HelpCommands = HelpCommands;
|
|
205
|
+
exports.HelpInvoke = HelpInvoke;
|
|
140
206
|
exports.HelpOptions = HelpOptions;
|
|
141
207
|
exports.HelpUsage = HelpUsage;
|
|
142
208
|
//# sourceMappingURL=help.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.cjs","names":["code","computed","For","Show","ReflectionKind","usePowerlines","getVariableCommandPathName","isVariableCommandPath","sortOptions","kebabCase","snakeCase","useTheme","HelpUsage","props","command","indent","context","theme","_$createComponent","each","Object","keys","config","bin","hardline","children","_$memo","path","segments","map","segment","variables","variadic","join","values","length","padding","app","_$createIntrinsic","HelpOptions","options","option","flags","names","name","push","alias","forEach","sort","kind","string","number","description","replace","env","default","undefined","envPrefix","JSON","stringify","HelpCommands","commands","child","Help","filter","some","globalOption","includes","when","value"],"sources":["../../src/components/help.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, computed, For, Show } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getVariableCommandPathName,\n isVariableCommandPath\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { sortOptions } from \"@shell-shock/core/plugin-utils/reflect\";\nimport type {\n CommandOption,\n CommandTree\n} from \"@shell-shock/core/types/command\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { useTheme } from \"../contexts\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface HelpUsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 2\n */\n indent?: number;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function HelpUsage(props: HelpUsageProps) {\n const { command, indent = 2 } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n return (\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.primary(\n \"$ npx ${bin} ${command.path.segments\n .map(segment =>\n isVariableCommandPath(segment)\n ? `<${command.path.variables[segment]?.variadic ? \"...\" : \"\"}${kebabCase(\n getVariableCommandPathName(segment)\n )}>`\n : segment\n )\n .join(\" \")}${\n Object.values(command.children).length > 0 ? \" [commands]\" : \"\"\n } [options]\"\n ), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n );\n}\n\nexport interface HelpOptionsProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n}\n\n/**\n * A component that generates the options table display for a command.\n */\nexport function HelpOptions(props: HelpOptionsProps) {\n const { options } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={sortOptions(options)} hardline>\n {option => {\n const flags = [] as string[];\n const names = [] as string[];\n if (option.name.length === 1) {\n flags.push(`-${option.name}`);\n } else {\n names.push(`--${kebabCase(option.name)}`);\n }\n\n option.alias.forEach((alias: string) => {\n if (alias.length === 1) {\n flags.push(`-${alias}`);\n } else {\n names.push(`--${kebabCase(alias)}`);\n }\n });\n\n return code`[{ value: colors.text.body.primary(\"${\n flags.length > 0\n ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}`\n : \"\"\n }${names.length > 0 ? names.sort().join(\", \") : \"\"}${\n option.kind === ReflectionKind.string\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : option.kind === ReflectionKind.number\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : \"\"\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${option.description.replace(\n /\\.+$/,\n \"\"\n )} ${\n option.env || option.default !== undefined\n ? `(${\n option.env\n ? `env: ${context.config.envPrefix}_${option.env}${\n option.default !== undefined ? \", \" : \"\"\n }`\n : \"\"\n }${\n option.default !== undefined\n ? `default: ${JSON.stringify(option.default)}`\n : \"\"\n })`\n : \"\"\n }.\"), align: \"left\", border: \"none\" }], `;\n }}\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpCommandsProps {\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n}\n\n/**\n * A component that generates the commands table display for a command.\n */\nexport function HelpCommands(props: HelpCommandsProps) {\n const { commands } = props;\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={Object.values(commands)} hardline>\n {child =>\n code`[{ value: colors.text.body.primary(\"${\n child.name\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${child.description.replace(\n /\\.+$/,\n \"\"\n )}\"), align: \"left\", border: \"none\" }], `\n }\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 1\n */\n indent?: number;\n}\n\n/**\n * A component that generates the `help` function declaration for a command.\n */\nexport function Help(props: HelpProps) {\n const { command, indent = 1 } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const options = computed(\n () =>\n Object.values(command.options).filter(\n option =>\n !context.options.some(\n globalOption =>\n globalOption.name === option.name ||\n option.alias.includes(globalOption.name) ||\n globalOption.alias?.includes(option.name) ||\n globalOption.alias?.some(alias => option.alias.includes(alias))\n )\n ) ?? []\n );\n\n return (\n <>\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Usage:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpUsage command={command} indent={indent} />\n <hbr />\n <hbr />\n <Show when={options.value.length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Options:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpOptions options={options.value} />\n <hbr />\n <hbr />\n </Show>\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Commands:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpCommands commands={command.children} />\n <hbr />\n <hbr />\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuDA,SAAgBY,UAAUC,OAAuB;CAC/C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s","names":["code","computed","For","Show","ReflectionKind","usePowerlines","Usage","getAppBin","sortOptions","kebabCase","snakeCase","useTheme","HelpUsage","props","command","indent","context","theme","_$createComponent","each","Object","keys","config","bin","hardline","children","_$memo","padding","app","_$createIntrinsic","HelpOptions","options","option","flags","names","name","length","push","alias","forEach","sort","join","kind","string","variadic","number","description","replace","env","default","undefined","envPrefix","JSON","stringify","HelpCommands","commands","values","child","Help","filter","some","globalOption","includes","when","value","HelpInvoke","doubleHardline","joiner","ender","title","isVirtual"],"sources":["../../src/components/help.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, computed, For, Show } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { Usage } from \"@shell-shock/core/components/usage\";\nimport { getAppBin } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { sortOptions } from \"@shell-shock/core/plugin-utils/reflect\";\nimport type {\n CommandOption,\n CommandTree\n} from \"@shell-shock/core/types/command\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { useTheme } from \"../contexts\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface HelpUsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 2\n */\n indent?: number;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function HelpUsage(props: HelpUsageProps) {\n const { command, indent = 2 } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n return (\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.primary(\"`}\n <Usage bin={bin} command={command} />\n {code`\"), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n );\n}\n\nexport interface HelpOptionsProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n}\n\n/**\n * A component that generates the options table display for a command.\n */\nexport function HelpOptions(props: HelpOptionsProps) {\n const { options } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={sortOptions(options)} hardline>\n {option => {\n const flags = [] as string[];\n const names = [] as string[];\n if (option.name.length === 1) {\n flags.push(`-${option.name}`);\n } else {\n names.push(`--${kebabCase(option.name)}`);\n }\n\n option.alias.forEach((alias: string) => {\n if (alias.length === 1) {\n flags.push(`-${alias}`);\n } else {\n names.push(`--${kebabCase(alias)}`);\n }\n });\n\n return code`[{ value: colors.text.body.primary(\"${\n flags.length > 0\n ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}`\n : \"\"\n }${names.length > 0 ? names.sort().join(\", \") : \"\"}${\n option.kind === ReflectionKind.string\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : option.kind === ReflectionKind.number\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : \"\"\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${option.description.replace(\n /\\.+$/,\n \"\"\n )} ${\n option.env || option.default !== undefined\n ? `(${\n option.env\n ? `env: ${context.config.envPrefix}_${option.env}${\n option.default !== undefined ? \", \" : \"\"\n }`\n : \"\"\n }${\n option.default !== undefined\n ? `default: ${JSON.stringify(option.default)}`\n : \"\"\n })`\n : \"\"\n }.\"), align: \"left\", border: \"none\" }], `;\n }}\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpCommandsProps {\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n}\n\n/**\n * A component that generates the commands table display for a command.\n */\nexport function HelpCommands(props: HelpCommandsProps) {\n const { commands } = props;\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={Object.values(commands)} hardline>\n {child =>\n code`[{ value: colors.text.body.primary(\"${\n child.name\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${child.description.replace(\n /\\.+$/,\n \"\"\n )}\"), align: \"left\", border: \"none\" }], `\n }\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 1\n */\n indent?: number;\n}\n\n/**\n * A component that generates the `help` function declaration for a command.\n */\nexport function Help(props: HelpProps) {\n const { command, indent = 1 } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const options = computed(\n () =>\n Object.values(command.options).filter(\n option =>\n !context.options.some(\n globalOption =>\n globalOption.name === option.name ||\n option.alias.includes(globalOption.name) ||\n globalOption.alias?.includes(option.name) ||\n globalOption.alias?.some(alias => option.alias.includes(alias))\n )\n ) ?? []\n );\n\n return (\n <>\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Usage:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpUsage command={command} indent={indent} />\n <hbr />\n <hbr />\n <Show when={options.value.length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Options:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpOptions options={options.value} />\n <hbr />\n <hbr />\n </Show>\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Commands:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpCommands commands={command.children} />\n <hbr />\n <hbr />\n </Show>\n </>\n );\n}\n\nexport interface HelpInvokeProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n}\n\n/**\n * A component that generates the invocation of the `help` function for a command.\n */\nexport function HelpInvoke(props: HelpInvokeProps) {\n const { options, commands } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`\n writeLine(\"\");\n banner();\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Global Options:\")));`}\n <hbr />\n <HelpOptions options={options} />\n {code`writeLine(\"\"); `}\n <hbr />\n <hbr />\n <Show when={Object.keys(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(commands)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(\"${child.title} ${\n child.isVirtual ? \"\" : \"Command\"\n }\"));\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(\n context\n )} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAqDA,SAAgBY,UAAUC,OAAuB;CAC/C,MAAM,EAAEC,SAASC,SAAS,MAA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/B,oBAAI;mDAAiB,OAAA,EAAA,CAAA;mDAAA,OAAA,EAAA,CAAA;mDAGrBG,sBAAI;GAAA,IAAC4D,OAAI;AAAA,WAAE3C,OAAOC,KAAKkC,SAAS,CAACnB,SAAS;;GAAC,IAAAX,WAAA;AAAA,WAAA;KACzCzB,oBAAI;;sDACW,OAAA,EAAA,CAAA;sDAAA,OAAA,EAAA,CAAA;sDAGfE,qBAAG;MAAA,IACFiB,OAAI;AAAA,cAAEC,OAAOoC,OAAOD,SAAS;;MAC7BW,gBAAc;MACdC,QAAQnE,oBAAI;MACZoE,OAAOpE,oBAAI;MAAiByB,WAC3BgC,UAAK;mDAEDzD,oBAAI;yDACsCyD,MAAMY,MAAK,GAClDZ,MAAMa,YAAY,KAAK,UAAS;;wDAGMb,MAAMX,YAAW;;kBAExD;wDAAA,OAAA,EAAA,CAAA;wDAEFY,MAAI;QAAC5C,SAAS2C;QAAO1C,QAAQ;QAAC,CAAA;wDAAA,OAAA,EAAA,CAAA;OAAA;MAGlC,CAAA;iDAEFf,oBAAI,6HACHgB,QACD,CAAA;kCACwB;KAAA;;GAAA,CAAA;EAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core7 from "@alloy-js/core";
|
|
2
2
|
import { CommandOption, CommandTree } from "@shell-shock/core/types/command";
|
|
3
3
|
|
|
4
4
|
//#region src/components/help.d.ts
|
|
@@ -20,7 +20,7 @@ interface HelpUsageProps {
|
|
|
20
20
|
/**
|
|
21
21
|
* A component that generates the usage display for a command.
|
|
22
22
|
*/
|
|
23
|
-
declare function HelpUsage(props: HelpUsageProps):
|
|
23
|
+
declare function HelpUsage(props: HelpUsageProps): _alloy_js_core7.Children;
|
|
24
24
|
interface HelpOptionsProps {
|
|
25
25
|
/**
|
|
26
26
|
* The options to display help for.
|
|
@@ -30,7 +30,7 @@ interface HelpOptionsProps {
|
|
|
30
30
|
/**
|
|
31
31
|
* A component that generates the options table display for a command.
|
|
32
32
|
*/
|
|
33
|
-
declare function HelpOptions(props: HelpOptionsProps):
|
|
33
|
+
declare function HelpOptions(props: HelpOptionsProps): _alloy_js_core7.Children;
|
|
34
34
|
interface HelpCommandsProps {
|
|
35
35
|
/**
|
|
36
36
|
* A mapping of command names to their command definitions.
|
|
@@ -40,7 +40,7 @@ interface HelpCommandsProps {
|
|
|
40
40
|
/**
|
|
41
41
|
* A component that generates the commands table display for a command.
|
|
42
42
|
*/
|
|
43
|
-
declare function HelpCommands(props: HelpCommandsProps):
|
|
43
|
+
declare function HelpCommands(props: HelpCommandsProps): _alloy_js_core7.Children;
|
|
44
44
|
interface HelpProps {
|
|
45
45
|
/**
|
|
46
46
|
* The command to generate help for.
|
|
@@ -59,7 +59,21 @@ interface HelpProps {
|
|
|
59
59
|
/**
|
|
60
60
|
* A component that generates the `help` function declaration for a command.
|
|
61
61
|
*/
|
|
62
|
-
declare function Help(props: HelpProps):
|
|
62
|
+
declare function Help(props: HelpProps): _alloy_js_core7.Children;
|
|
63
|
+
interface HelpInvokeProps {
|
|
64
|
+
/**
|
|
65
|
+
* The options to display help for.
|
|
66
|
+
*/
|
|
67
|
+
options: CommandOption[];
|
|
68
|
+
/**
|
|
69
|
+
* A mapping of command names to their command definitions.
|
|
70
|
+
*/
|
|
71
|
+
commands: Record<string, CommandTree>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A component that generates the invocation of the `help` function for a command.
|
|
75
|
+
*/
|
|
76
|
+
declare function HelpInvoke(props: HelpInvokeProps): _alloy_js_core7.Children;
|
|
63
77
|
//#endregion
|
|
64
|
-
export { Help, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps };
|
|
78
|
+
export { Help, HelpCommands, HelpCommandsProps, HelpInvoke, HelpInvokeProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps };
|
|
65
79
|
//# sourceMappingURL=help.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.cts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"help.d.cts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;UAiCiB,cAAA;;;AAAjB;EAoBgB,OAAA,EAhBL,WAgBc;EAuBR;AAUjB;AA+DA;AAUA;AAuBA;AAoBA;AAqDA;;EAS2B,MAAA,CAAA,EAAA,MAAA;;;AAM3B;;iBAzNgB,SAAA,QAAiB,iBAAc,eAAA,CAAA;UAuB9B,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,eAAA,CAAA;UA+DlC,iBAAA;;;;YAIL,eAAe;;;;;iBAMX,YAAA,QAAoB,oBAAiB,eAAA,CAAA;UAuBpC,SAAA;;;;WAIN;;;;;;;;;;;;;;iBAgBK,IAAA,QAAY,YAAS,eAAA,CAAA;UAqDpB,eAAA;;;;WAIN;;;;YAKC,eAAe;;;;;iBAMX,UAAA,QAAkB,kBAAe,eAAA,CAAA"}
|
|
@@ -60,6 +60,20 @@ interface HelpProps {
|
|
|
60
60
|
* A component that generates the `help` function declaration for a command.
|
|
61
61
|
*/
|
|
62
62
|
declare function Help(props: HelpProps): _alloy_js_core7.Children;
|
|
63
|
+
interface HelpInvokeProps {
|
|
64
|
+
/**
|
|
65
|
+
* The options to display help for.
|
|
66
|
+
*/
|
|
67
|
+
options: CommandOption[];
|
|
68
|
+
/**
|
|
69
|
+
* A mapping of command names to their command definitions.
|
|
70
|
+
*/
|
|
71
|
+
commands: Record<string, CommandTree>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A component that generates the invocation of the `help` function for a command.
|
|
75
|
+
*/
|
|
76
|
+
declare function HelpInvoke(props: HelpInvokeProps): _alloy_js_core7.Children;
|
|
63
77
|
//#endregion
|
|
64
|
-
export { Help, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps };
|
|
78
|
+
export { Help, HelpCommands, HelpCommandsProps, HelpInvoke, HelpInvokeProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps };
|
|
65
79
|
//# sourceMappingURL=help.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.mts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"help.d.mts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;UAiCiB,cAAA;;;AAAjB;EAoBgB,OAAA,EAhBL,WAgBc;EAuBR;AAUjB;AA+DA;AAUA;AAuBA;AAoBA;AAqDA;;EAS2B,MAAA,CAAA,EAAA,MAAA;;;AAM3B;;iBAzNgB,SAAA,QAAiB,iBAAc,eAAA,CAAA;UAuB9B,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,eAAA,CAAA;UA+DlC,iBAAA;;;;YAIL,eAAe;;;;;iBAMX,YAAA,QAAoB,oBAAiB,eAAA,CAAA;UAuBpC,SAAA;;;;WAIN;;;;;;;;;;;;;;iBAgBK,IAAA,QAAY,YAAS,eAAA,CAAA;UAqDpB,eAAA;;;;WAIN;;;;YAKC,eAAe;;;;;iBAMX,UAAA,QAAkB,kBAAe,eAAA,CAAA"}
|
package/dist/components/help.mjs
CHANGED
|
@@ -2,9 +2,10 @@ import { useTheme } from "../contexts/theme.mjs";
|
|
|
2
2
|
import "../contexts/index.mjs";
|
|
3
3
|
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
4
4
|
import { For, Show, code, computed } from "@alloy-js/core";
|
|
5
|
-
import { getVariableCommandPathName, isVariableCommandPath } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
6
5
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
6
|
+
import { getAppBin } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
7
7
|
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
8
|
+
import { Usage } from "@shell-shock/core/components/usage";
|
|
8
9
|
import { sortOptions } from "@shell-shock/core/plugin-utils/reflect";
|
|
9
10
|
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
10
11
|
import { snakeCase } from "@stryke/string-format/snake-case";
|
|
@@ -22,12 +23,18 @@ function HelpUsage(props) {
|
|
|
22
23
|
return Object.keys(context.config.bin);
|
|
23
24
|
},
|
|
24
25
|
hardline: true,
|
|
25
|
-
children: (bin) => [
|
|
26
|
+
children: (bin) => [
|
|
27
|
+
code`
|
|
26
28
|
writeLine(
|
|
27
|
-
colors.text.body.primary(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
colors.text.body.primary("`,
|
|
30
|
+
createComponent(Usage, {
|
|
31
|
+
bin,
|
|
32
|
+
command
|
|
33
|
+
}),
|
|
34
|
+
memo(() => code`"), { padding: ${theme.padding.app * indent} }
|
|
35
|
+
);`),
|
|
36
|
+
createIntrinsic("hbr", {})
|
|
37
|
+
]
|
|
31
38
|
});
|
|
32
39
|
}
|
|
33
40
|
/**
|
|
@@ -132,7 +139,65 @@ function Help(props) {
|
|
|
132
139
|
})
|
|
133
140
|
];
|
|
134
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* A component that generates the invocation of the `help` function for a command.
|
|
144
|
+
*/
|
|
145
|
+
function HelpInvoke(props) {
|
|
146
|
+
const { options, commands } = props;
|
|
147
|
+
const context = usePowerlines();
|
|
148
|
+
return [
|
|
149
|
+
code`
|
|
150
|
+
writeLine("");
|
|
151
|
+
banner();
|
|
152
|
+
writeLine(""); `,
|
|
153
|
+
createIntrinsic("hbr", {}),
|
|
154
|
+
createIntrinsic("hbr", {}),
|
|
155
|
+
code`writeLine(colors.bold(colors.text.heading.secondary("Global Options:")));`,
|
|
156
|
+
createIntrinsic("hbr", {}),
|
|
157
|
+
createComponent(HelpOptions, { options }),
|
|
158
|
+
code`writeLine(""); `,
|
|
159
|
+
createIntrinsic("hbr", {}),
|
|
160
|
+
createIntrinsic("hbr", {}),
|
|
161
|
+
createComponent(Show, {
|
|
162
|
+
get when() {
|
|
163
|
+
return Object.keys(commands).length > 0;
|
|
164
|
+
},
|
|
165
|
+
get children() {
|
|
166
|
+
return [
|
|
167
|
+
code`writeLine(colors.text.body.secondary("The following commands are available:"));
|
|
168
|
+
writeLine(""); `,
|
|
169
|
+
createIntrinsic("hbr", {}),
|
|
170
|
+
createIntrinsic("hbr", {}),
|
|
171
|
+
createComponent(For, {
|
|
172
|
+
get each() {
|
|
173
|
+
return Object.values(commands);
|
|
174
|
+
},
|
|
175
|
+
doubleHardline: true,
|
|
176
|
+
joiner: code`writeLine(""); `,
|
|
177
|
+
ender: code`writeLine(""); `,
|
|
178
|
+
children: (child) => [
|
|
179
|
+
memo(() => code`
|
|
180
|
+
writeLine(colors.text.heading.primary("${child.title} ${child.isVirtual ? "" : "Command"}"));
|
|
181
|
+
writeLine("");
|
|
182
|
+
writeLine(colors.text.body.secondary("${child.description}"));
|
|
183
|
+
writeLine("");
|
|
184
|
+
`),
|
|
185
|
+
createIntrinsic("hbr", {}),
|
|
186
|
+
createComponent(Help, {
|
|
187
|
+
command: child,
|
|
188
|
+
indent: 2
|
|
189
|
+
}),
|
|
190
|
+
createIntrinsic("hbr", {})
|
|
191
|
+
]
|
|
192
|
+
}),
|
|
193
|
+
memo(() => code`help("Running a specific command with the help flag (via: '${getAppBin(context)} <specific command> --help') will provide additional information that is specific to that command.");
|
|
194
|
+
writeLine("");`)
|
|
195
|
+
];
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
];
|
|
199
|
+
}
|
|
135
200
|
|
|
136
201
|
//#endregion
|
|
137
|
-
export { Help, HelpCommands, HelpOptions, HelpUsage };
|
|
202
|
+
export { Help, HelpCommands, HelpInvoke, HelpOptions, HelpUsage };
|
|
138
203
|
//# sourceMappingURL=help.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.mjs","names":["code","computed","For","Show","ReflectionKind","usePowerlines","getVariableCommandPathName","isVariableCommandPath","sortOptions","kebabCase","snakeCase","useTheme","HelpUsage","props","command","indent","context","theme","_$createComponent","each","Object","keys","config","bin","hardline","children","_$memo","path","segments","map","segment","variables","variadic","join","values","length","padding","app","_$createIntrinsic","HelpOptions","options","option","flags","names","name","push","alias","forEach","sort","kind","string","number","description","replace","env","default","undefined","envPrefix","JSON","stringify","HelpCommands","commands","child","Help","filter","some","globalOption","includes","when","value"],"sources":["../../src/components/help.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, computed, For, Show } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getVariableCommandPathName,\n isVariableCommandPath\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { sortOptions } from \"@shell-shock/core/plugin-utils/reflect\";\nimport type {\n CommandOption,\n CommandTree\n} from \"@shell-shock/core/types/command\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { useTheme } from \"../contexts\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface HelpUsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 2\n */\n indent?: number;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function HelpUsage(props: HelpUsageProps) {\n const { command, indent = 2 } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n return (\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.primary(\n \"$ npx ${bin} ${command.path.segments\n .map(segment =>\n isVariableCommandPath(segment)\n ? `<${command.path.variables[segment]?.variadic ? \"...\" : \"\"}${kebabCase(\n getVariableCommandPathName(segment)\n )}>`\n : segment\n )\n .join(\" \")}${\n Object.values(command.children).length > 0 ? \" [commands]\" : \"\"\n } [options]\"\n ), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n );\n}\n\nexport interface HelpOptionsProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n}\n\n/**\n * A component that generates the options table display for a command.\n */\nexport function HelpOptions(props: HelpOptionsProps) {\n const { options } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={sortOptions(options)} hardline>\n {option => {\n const flags = [] as string[];\n const names = [] as string[];\n if (option.name.length === 1) {\n flags.push(`-${option.name}`);\n } else {\n names.push(`--${kebabCase(option.name)}`);\n }\n\n option.alias.forEach((alias: string) => {\n if (alias.length === 1) {\n flags.push(`-${alias}`);\n } else {\n names.push(`--${kebabCase(alias)}`);\n }\n });\n\n return code`[{ value: colors.text.body.primary(\"${\n flags.length > 0\n ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}`\n : \"\"\n }${names.length > 0 ? names.sort().join(\", \") : \"\"}${\n option.kind === ReflectionKind.string\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : option.kind === ReflectionKind.number\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : \"\"\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${option.description.replace(\n /\\.+$/,\n \"\"\n )} ${\n option.env || option.default !== undefined\n ? `(${\n option.env\n ? `env: ${context.config.envPrefix}_${option.env}${\n option.default !== undefined ? \", \" : \"\"\n }`\n : \"\"\n }${\n option.default !== undefined\n ? `default: ${JSON.stringify(option.default)}`\n : \"\"\n })`\n : \"\"\n }.\"), align: \"left\", border: \"none\" }], `;\n }}\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpCommandsProps {\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n}\n\n/**\n * A component that generates the commands table display for a command.\n */\nexport function HelpCommands(props: HelpCommandsProps) {\n const { commands } = props;\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={Object.values(commands)} hardline>\n {child =>\n code`[{ value: colors.text.body.primary(\"${\n child.name\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${child.description.replace(\n /\\.+$/,\n \"\"\n )}\"), align: \"left\", border: \"none\" }], `\n }\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 1\n */\n indent?: number;\n}\n\n/**\n * A component that generates the `help` function declaration for a command.\n */\nexport function Help(props: HelpProps) {\n const { command, indent = 1 } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const options = computed(\n () =>\n Object.values(command.options).filter(\n option =>\n !context.options.some(\n globalOption =>\n globalOption.name === option.name ||\n option.alias.includes(globalOption.name) ||\n globalOption.alias?.includes(option.name) ||\n globalOption.alias?.some(alias => option.alias.includes(alias))\n )\n ) ?? []\n );\n\n return (\n <>\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Usage:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpUsage command={command} indent={indent} />\n <hbr />\n <hbr />\n <Show when={options.value.length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Options:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpOptions options={options.value} />\n <hbr />\n <hbr />\n </Show>\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Commands:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpCommands commands={command.children} />\n <hbr />\n <hbr />\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuDA,SAAgBY,UAAUC,OAAuB;CAC/C,MAAM,EAAEC,SAASC,SAAS,MAAMF;CAEhC,MAAMG,UAAUX,eAAoC;CACpD,MAAMY,QAAQN,UAAU;AAExB,QAAAO,gBACGhB,KAAG;EAAA,IAACiB,OAAI;AAAA,UAAEC,OAAOC,KAAKL,QAAQM,OAAOC,IAAI;;EAAEC,UAAQ;EAAAC,WACjDF,QAAG,CAAAG,WAEC1B,IAAI;;;mBAGIuB,IAAG,GAAIT,QAAQa,KAAKC,SAC1BC,KAAIC,YACHvB,sBAAsBuB,QAAQ,GAC1B,IAAIhB,QAAQa,KAAKI,UAAUD,UAAUE,WAAW,QAAQ,KAAKvB,UAC3DH,2BAA2BwB,QAC7B,CAAC,CAAA,KACDA,QACL,CACAG,KAAK,IAAI,GACVb,OAAOc,OAAOpB,QAAQW,SAAS,CAACU,SAAS,IAAI,gBAAgB,GAAE;wBAEnDlB,MAAMmB,QAAQC,MAAMtB,OAAM;UACzC,EAAAuB,gBAAA,OAAA,EAAA,CAAA,CAAA;EAGF,CAAA;;;;;AAeP,SAAgBC,YAAY1B,OAAyB;CACnD,MAAM,EAAE2B,YAAY3B;CAEpB,MAAMG,UAAUX,eAAoC;AAEpD,QAAA;EAEKL,IAAI;EAAU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AC,WACjC1B,IAAI;wEAELe,SAAS,IAAI,gBAAgBE,MAAMmB,QAAQC,MAAMtB,OAAM,MAAO,GAAE,IAC9D;KAAAuB,gBAAA,OAAA,EAAA,CAAA;KAAApB,gBAEDqB,aAAW,EAAA,IAACC,UAAO;AAAA,aAAEA,QAAQ6B;QAAK,CAAA;KAAA/B,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA;EAAApB,gBAIpCf,MAAI;GAAA,IAACiE,OAAI;AAAA,WAAEhD,OAAOC,KAAKP,QAAQW,SAAS,CAACU,SAAS;;GAAC,IAAAV,WAAA;AAAA,WAAA;KAAAC,WACjD1B,IAAI;yEAELe,SAAS,IAAI,gBAAgBE,MAAMmB,QAAQC,MAAMtB,OAAM,MAAO,GAAE,IAC9D;KAAAuB,gBAAA,OAAA,EAAA,CAAA;KAAApB,gBAED0C,cAAY,EAAA,IAACC,WAAQ;AAAA,aAAE/C,QAAQW;QAAQ,CAAA;KAAAa,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA;EAAA"}
|
|
1
|
+
{"version":3,"file":"help.mjs","names":["code","computed","For","Show","ReflectionKind","usePowerlines","Usage","getAppBin","sortOptions","kebabCase","snakeCase","useTheme","HelpUsage","props","command","indent","context","theme","_$createComponent","each","Object","keys","config","bin","hardline","children","_$memo","padding","app","_$createIntrinsic","HelpOptions","options","option","flags","names","name","length","push","alias","forEach","sort","join","kind","string","variadic","number","description","replace","env","default","undefined","envPrefix","JSON","stringify","HelpCommands","commands","values","child","Help","filter","some","globalOption","includes","when","value","HelpInvoke","doubleHardline","joiner","ender","title","isVirtual"],"sources":["../../src/components/help.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, computed, For, Show } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { Usage } from \"@shell-shock/core/components/usage\";\nimport { getAppBin } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { sortOptions } from \"@shell-shock/core/plugin-utils/reflect\";\nimport type {\n CommandOption,\n CommandTree\n} from \"@shell-shock/core/types/command\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { useTheme } from \"../contexts\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface HelpUsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 2\n */\n indent?: number;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function HelpUsage(props: HelpUsageProps) {\n const { command, indent = 2 } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n return (\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.primary(\"`}\n <Usage bin={bin} command={command} />\n {code`\"), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n );\n}\n\nexport interface HelpOptionsProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n}\n\n/**\n * A component that generates the options table display for a command.\n */\nexport function HelpOptions(props: HelpOptionsProps) {\n const { options } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={sortOptions(options)} hardline>\n {option => {\n const flags = [] as string[];\n const names = [] as string[];\n if (option.name.length === 1) {\n flags.push(`-${option.name}`);\n } else {\n names.push(`--${kebabCase(option.name)}`);\n }\n\n option.alias.forEach((alias: string) => {\n if (alias.length === 1) {\n flags.push(`-${alias}`);\n } else {\n names.push(`--${kebabCase(alias)}`);\n }\n });\n\n return code`[{ value: colors.text.body.primary(\"${\n flags.length > 0\n ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}`\n : \"\"\n }${names.length > 0 ? names.sort().join(\", \") : \"\"}${\n option.kind === ReflectionKind.string\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : option.kind === ReflectionKind.number\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : \"\"\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${option.description.replace(\n /\\.+$/,\n \"\"\n )} ${\n option.env || option.default !== undefined\n ? `(${\n option.env\n ? `env: ${context.config.envPrefix}_${option.env}${\n option.default !== undefined ? \", \" : \"\"\n }`\n : \"\"\n }${\n option.default !== undefined\n ? `default: ${JSON.stringify(option.default)}`\n : \"\"\n })`\n : \"\"\n }.\"), align: \"left\", border: \"none\" }], `;\n }}\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpCommandsProps {\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n}\n\n/**\n * A component that generates the commands table display for a command.\n */\nexport function HelpCommands(props: HelpCommandsProps) {\n const { commands } = props;\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={Object.values(commands)} hardline>\n {child =>\n code`[{ value: colors.text.body.primary(\"${\n child.name\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${child.description.replace(\n /\\.+$/,\n \"\"\n )}\"), align: \"left\", border: \"none\" }], `\n }\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 1\n */\n indent?: number;\n}\n\n/**\n * A component that generates the `help` function declaration for a command.\n */\nexport function Help(props: HelpProps) {\n const { command, indent = 1 } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const options = computed(\n () =>\n Object.values(command.options).filter(\n option =>\n !context.options.some(\n globalOption =>\n globalOption.name === option.name ||\n option.alias.includes(globalOption.name) ||\n globalOption.alias?.includes(option.name) ||\n globalOption.alias?.some(alias => option.alias.includes(alias))\n )\n ) ?? []\n );\n\n return (\n <>\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Usage:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpUsage command={command} indent={indent} />\n <hbr />\n <hbr />\n <Show when={options.value.length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Options:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpOptions options={options.value} />\n <hbr />\n <hbr />\n </Show>\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Commands:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpCommands commands={command.children} />\n <hbr />\n <hbr />\n </Show>\n </>\n );\n}\n\nexport interface HelpInvokeProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n}\n\n/**\n * A component that generates the invocation of the `help` function for a command.\n */\nexport function HelpInvoke(props: HelpInvokeProps) {\n const { options, commands } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`\n writeLine(\"\");\n banner();\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Global Options:\")));`}\n <hbr />\n <HelpOptions options={options} />\n {code`writeLine(\"\"); `}\n <hbr />\n <hbr />\n <Show when={Object.keys(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(commands)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(\"${child.title} ${\n child.isVirtual ? \"\" : \"Command\"\n }\"));\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(\n context\n )} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAqDA,SAAgBY,UAAUC,OAAuB;CAC/C,MAAM,EAAEC,SAASC,SAAS,MAAMF;CAEhC,MAAMG,UAAUX,eAAoC;CACpD,MAAMY,QAAQN,UAAU;AAExB,QAAAO,gBACGhB,KAAG;EAAA,IAACiB,OAAI;AAAA,UAAEC,OAAOC,KAAKL,QAAQM,OAAOC,IAAI;;EAAEC,UAAQ;EAAAC,WACjDF,QAAG;GAECvB,IAAI;;;GAEoBkB,gBACxBZ,OAAK;IAAMiB;IAAcT;IAAO,CAAA;GAAAY,WAChC1B,IAAI,kBAAkBiB,MAAMU,QAAQC,MAAMb,OAAM;UAClD;GAAAc,gBAAA,OAAA,EAAA,CAAA;GAAA;EAGF,CAAA;;;;;AAeP,SAAgBC,YAAYjB,OAAyB;CACnD,MAAM,EAAEkB,YAAYlB;CAEpB,MAAMG,UAAUX,eAAoC;AAEpD,QAAA;E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ACzCzB,IAAI;;KACW6B,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAX,gBAGfhB,KAAG;MAAA,IACFiB,OAAI;AAAA,cAAEC,OAAOoC,OAAOD,SAAS;;MAC7BW,gBAAc;MACdC,QAAQnE,IAAI;MACZoE,OAAOpE,IAAI;MAAiByB,WAC3BgC,UAAK;OAAA/B,WAED1B,IAAI;yDACsCyD,MAAMY,MAAK,GAClDZ,MAAMa,YAAY,KAAK,UAAS;;wDAGMb,MAAMX,YAAW;;kBAExD;OAAAjB,gBAAA,OAAA,EAAA,CAAA;OAAAX,gBAEFwC,MAAI;QAAC5C,SAAS2C;QAAO1C,QAAQ;QAAC,CAAA;OAAAc,gBAAA,OAAA,EAAA,CAAA;OAAA;MAGlC,CAAA;KAAAH,WAEF1B,IAAI,8DAA8DO,UACjES,QACD,CAAA;kCACwB;KAAA;;GAAA,CAAA;EAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
const require_components_banner_function_declaration = require('./banner-function-declaration.cjs');
|
|
1
2
|
const require_components_bin_entry = require('./bin-entry.cjs');
|
|
2
|
-
const require_components_args_parser_logic = require('./args-parser-logic.cjs');
|
|
3
3
|
const require_components_help = require('./help.cjs');
|
|
4
4
|
const require_components_command_router = require('./command-router.cjs');
|
|
5
5
|
const require_components_virtual_command_entry = require('./virtual-command-entry.cjs');
|
|
@@ -8,7 +8,7 @@ const require_components_console_builtin = require('./console-builtin.cjs');
|
|
|
8
8
|
const require_components_utils_builtin = require('./utils-builtin.cjs');
|
|
9
9
|
|
|
10
10
|
exports.ArgsUtilities = require_components_utils_builtin.ArgsUtilities;
|
|
11
|
-
exports.BannerFunctionDeclaration =
|
|
11
|
+
exports.BannerFunctionDeclaration = require_components_banner_function_declaration.BannerFunctionDeclaration;
|
|
12
12
|
exports.BinEntry = require_components_bin_entry.BinEntry;
|
|
13
13
|
exports.ColorSupportUtilities = require_components_utils_builtin.ColorSupportUtilities;
|
|
14
14
|
exports.ColorsDeclaration = require_components_console_builtin.ColorsDeclaration;
|
|
@@ -23,21 +23,16 @@ exports.EnvSupportUtilities = require_components_utils_builtin.EnvSupportUtiliti
|
|
|
23
23
|
exports.ExitFunctionDeclaration = require_components_utils_builtin.ExitFunctionDeclaration;
|
|
24
24
|
exports.Help = require_components_help.Help;
|
|
25
25
|
exports.HelpCommands = require_components_help.HelpCommands;
|
|
26
|
+
exports.HelpInvoke = require_components_help.HelpInvoke;
|
|
26
27
|
exports.HelpOptions = require_components_help.HelpOptions;
|
|
27
28
|
exports.HelpUsage = require_components_help.HelpUsage;
|
|
28
29
|
exports.HyperlinkSupportUtilities = require_components_utils_builtin.HyperlinkSupportUtilities;
|
|
29
30
|
exports.LinkFunctionDeclaration = require_components_console_builtin.LinkFunctionDeclaration;
|
|
30
31
|
exports.MessageFunctionDeclaration = require_components_console_builtin.MessageFunctionDeclaration;
|
|
31
|
-
exports.OptionsInterfaceDeclaration = require_components_args_parser_logic.OptionsInterfaceDeclaration;
|
|
32
|
-
exports.OptionsMember = require_components_args_parser_logic.OptionsMember;
|
|
33
|
-
exports.OptionsMemberParserLogic = require_components_args_parser_logic.OptionsMemberParserLogic;
|
|
34
|
-
exports.OptionsParserLogic = require_components_args_parser_logic.OptionsParserLogic;
|
|
35
|
-
exports.ParamsParserLogic = require_components_args_parser_logic.ParamsParserLogic;
|
|
36
32
|
exports.RunApplication = require_components_bin_entry.RunApplication;
|
|
37
33
|
exports.StripAnsiFunctionDeclaration = require_components_console_builtin.StripAnsiFunctionDeclaration;
|
|
38
34
|
exports.TableFunctionDeclaration = require_components_console_builtin.TableFunctionDeclaration;
|
|
39
35
|
exports.UtilsBuiltin = require_components_utils_builtin.UtilsBuiltin;
|
|
40
|
-
exports.VariablePathsParserLogic = require_components_args_parser_logic.VariablePathsParserLogic;
|
|
41
36
|
exports.VirtualCommandEntry = require_components_virtual_command_entry.VirtualCommandEntry;
|
|
42
37
|
exports.VirtualCommandHandlerDeclaration = require_components_virtual_command_entry.VirtualCommandHandlerDeclaration;
|
|
43
38
|
exports.WrapAnsiFunction = require_components_console_builtin.WrapAnsiFunction;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BannerFunctionDeclaration, BannerFunctionDeclarationProps } from "./banner-function-declaration.cjs";
|
|
2
2
|
import { BinEntry, BinEntryProps, RunApplication } from "./bin-entry.cjs";
|
|
3
3
|
import { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation } from "./command-entry.cjs";
|
|
4
4
|
import { CommandRouter, CommandRouterProps, CommandRouterRoute } from "./command-router.cjs";
|
|
5
|
-
import {
|
|
6
|
-
import { Help, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps } from "./help.cjs";
|
|
5
|
+
import { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.cjs";
|
|
6
|
+
import { Help, HelpCommands, HelpCommandsProps, HelpInvoke, HelpInvokeProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps } from "./help.cjs";
|
|
7
7
|
import { ArgsUtilities, ColorSupportUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.cjs";
|
|
8
8
|
import { VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration } from "./virtual-command-entry.cjs";
|
|
9
|
-
export { ArgsUtilities, BannerFunctionDeclaration, BannerFunctionDeclarationProps, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin,
|
|
9
|
+
export { ArgsUtilities, BannerFunctionDeclaration, BannerFunctionDeclarationProps, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, Help, HelpCommands, HelpCommandsProps, HelpInvoke, HelpInvokeProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BannerFunctionDeclaration, BannerFunctionDeclarationProps } from "./banner-function-declaration.mjs";
|
|
2
2
|
import { BinEntry, BinEntryProps, RunApplication } from "./bin-entry.mjs";
|
|
3
3
|
import { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation } from "./command-entry.mjs";
|
|
4
4
|
import { CommandRouter, CommandRouterProps, CommandRouterRoute } from "./command-router.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { Help, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps } from "./help.mjs";
|
|
5
|
+
import { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.mjs";
|
|
6
|
+
import { Help, HelpCommands, HelpCommandsProps, HelpInvoke, HelpInvokeProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps } from "./help.mjs";
|
|
7
7
|
import { ArgsUtilities, ColorSupportUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.mjs";
|
|
8
8
|
import { VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration } from "./virtual-command-entry.mjs";
|
|
9
|
-
export { ArgsUtilities, BannerFunctionDeclaration, BannerFunctionDeclarationProps, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin,
|
|
9
|
+
export { ArgsUtilities, BannerFunctionDeclaration, BannerFunctionDeclarationProps, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, Help, HelpCommands, HelpCommandsProps, HelpInvoke, HelpInvokeProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { BannerFunctionDeclaration } from "./banner-function-declaration.mjs";
|
|
1
2
|
import { BinEntry, RunApplication } from "./bin-entry.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { Help, HelpCommands, HelpOptions, HelpUsage } from "./help.mjs";
|
|
3
|
+
import { Help, HelpCommands, HelpInvoke, HelpOptions, HelpUsage } from "./help.mjs";
|
|
4
4
|
import { CommandRouter, CommandRouterRoute } from "./command-router.mjs";
|
|
5
5
|
import { VirtualCommandEntry, VirtualCommandHandlerDeclaration } from "./virtual-command-entry.mjs";
|
|
6
6
|
import { CommandEntry, CommandHandlerDeclaration, CommandInvocation } from "./command-entry.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, StripAnsiFunctionDeclaration, TableFunctionDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.mjs";
|
|
8
8
|
import { ArgsUtilities, ColorSupportUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin } from "./utils-builtin.mjs";
|
|
9
9
|
|
|
10
|
-
export { ArgsUtilities, BannerFunctionDeclaration, BinEntry, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, Help, HelpCommands, HelpOptions, HelpUsage, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration,
|
|
10
|
+
export { ArgsUtilities, BannerFunctionDeclaration, BinEntry, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, Help, HelpCommands, HelpInvoke, HelpOptions, HelpUsage, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, UtilsBuiltin, VirtualCommandEntry, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
@@ -2,8 +2,8 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
|
2
2
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
3
|
let __alloy_js_core = require("@alloy-js/core");
|
|
4
4
|
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
5
|
-
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
6
5
|
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
6
|
+
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
7
7
|
let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
8
8
|
let defu = require("defu");
|
|
9
9
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
3
3
|
|
|
4
4
|
//#region src/components/utils-builtin.d.ts
|
|
@@ -6,27 +6,27 @@ interface UtilsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
|
|
|
6
6
|
/**
|
|
7
7
|
* Generates utilities for detecting terminal color support.
|
|
8
8
|
*/
|
|
9
|
-
declare function EnvSupportUtilities():
|
|
9
|
+
declare function EnvSupportUtilities(): _alloy_js_core0.Children;
|
|
10
10
|
/**
|
|
11
11
|
* Generates utilities for detecting terminal color support.
|
|
12
12
|
*/
|
|
13
|
-
declare function ColorSupportUtilities():
|
|
13
|
+
declare function ColorSupportUtilities(): _alloy_js_core0.Children;
|
|
14
14
|
/**
|
|
15
15
|
* Generates utilities for detecting terminal color support.
|
|
16
16
|
*/
|
|
17
|
-
declare function HyperlinkSupportUtilities():
|
|
17
|
+
declare function HyperlinkSupportUtilities(): _alloy_js_core0.Children;
|
|
18
18
|
/**
|
|
19
19
|
* Generates utilities for detecting terminal color support.
|
|
20
20
|
*/
|
|
21
|
-
declare function ArgsUtilities():
|
|
21
|
+
declare function ArgsUtilities(): _alloy_js_core0.Children;
|
|
22
22
|
/**
|
|
23
23
|
* The `exit` handler function declaration code for the Shell Shock project.
|
|
24
24
|
*/
|
|
25
|
-
declare function ExitFunctionDeclaration():
|
|
25
|
+
declare function ExitFunctionDeclaration(): _alloy_js_core0.Children;
|
|
26
26
|
/**
|
|
27
27
|
* A built-in utilities module for Shell Shock.
|
|
28
28
|
*/
|
|
29
|
-
declare function UtilsBuiltin(props: UtilsBuiltinProps):
|
|
29
|
+
declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core0.Children;
|
|
30
30
|
//#endregion
|
|
31
31
|
export { ArgsUtilities, ColorSupportUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps };
|
|
32
32
|
//# sourceMappingURL=utils-builtin.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { Show, code, splitProps } from "@alloy-js/core";
|
|
3
3
|
import { FunctionDeclaration, InterfaceDeclaration, InterfaceMember, VarDeclaration } from "@alloy-js/typescript";
|
|
4
|
-
import { getAppTitle } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
5
4
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
5
|
+
import { getAppTitle } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
6
6
|
import { TSDoc, TSDocLink, TSDocParam, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
7
7
|
import defu from "defu";
|
|
8
8
|
import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|