@shell-shock/plugin-help 0.2.25 → 0.2.26
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/_virtual/_rolldown/runtime.cjs +1 -29
- package/dist/components/display.cjs +18 -278
- package/dist/components/display.mjs +18 -271
- package/dist/components/display.mjs.map +1 -1
- package/dist/components/help-builtin.cjs +1 -99
- package/dist/components/help-builtin.mjs +1 -96
- package/dist/components/help-builtin.mjs.map +1 -1
- package/dist/components/help-command.cjs +1 -152
- package/dist/components/help-command.mjs +1 -149
- package/dist/components/help-command.mjs.map +1 -1
- package/dist/components/index.cjs +1 -14
- package/dist/components/index.mjs +1 -5
- package/dist/index.cjs +1 -98
- package/dist/index.mjs +1 -92
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +15 -15
|
@@ -1,97 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { Show, splitProps } from "@alloy-js/core";
|
|
4
|
-
import { getAppTitle, isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
5
|
-
import defu from "defu";
|
|
6
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
7
|
-
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
8
|
-
import { FunctionDeclaration } from "@alloy-js/typescript";
|
|
9
|
-
import { TSDoc, TSDocRemarks } from "@powerlines/plugin-alloy/typescript";
|
|
10
|
-
import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
11
|
-
import { joinPaths } from "@stryke/path";
|
|
12
|
-
|
|
13
|
-
//#region src/components/help-builtin.tsx
|
|
14
|
-
/**
|
|
15
|
-
* A built-in help module for Shell Shock.
|
|
16
|
-
*/
|
|
17
|
-
function HelpBuiltin(props) {
|
|
18
|
-
const [{ command, children }, rest] = splitProps(props, ["command", "children"]);
|
|
19
|
-
const context = usePowerlines();
|
|
20
|
-
return createComponent(BuiltinFile, mergeProps({
|
|
21
|
-
get id() {
|
|
22
|
-
return joinPaths("help", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)));
|
|
23
|
-
},
|
|
24
|
-
get description() {
|
|
25
|
-
return memo(() => !!command.path)() ? `A collection of utility functions that assist in displaying help information for the ${command.title} command.` : `A collection of utility functions that assist in displaying help information for the ${getAppTitle(context, true)} command-line interface application.`;
|
|
26
|
-
}
|
|
27
|
-
}, rest, {
|
|
28
|
-
get builtinImports() {
|
|
29
|
-
return defu(rest.builtinImports ?? {}, {
|
|
30
|
-
utils: ["isUnicodeSupported"],
|
|
31
|
-
console: [
|
|
32
|
-
"splitText",
|
|
33
|
-
"writeLine",
|
|
34
|
-
"inlineCode",
|
|
35
|
-
"textColors",
|
|
36
|
-
"inverse",
|
|
37
|
-
"bold",
|
|
38
|
-
"help",
|
|
39
|
-
"table",
|
|
40
|
-
"link"
|
|
41
|
-
]
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
get children() {
|
|
45
|
-
return [
|
|
46
|
-
createComponent(TSDoc, {
|
|
47
|
-
get heading() {
|
|
48
|
-
return `Utility functions for displaying help information for the ${command.path ? `${command.title} command` : `${getAppTitle(context, true)} application`}.`;
|
|
49
|
-
},
|
|
50
|
-
get children() {
|
|
51
|
-
return createComponent(TSDocRemarks, { get children() {
|
|
52
|
-
return `This module contains utility functions that assist in displaying help information for the ${command.path ? `${command.title} command` : `${getAppTitle(context, true)} application`}. The main function exported by this module is the \`showHelp\` function, which can be used to display help information for the specified command or application. This function can be called from within the command's handler or from any other part of the application where help information needs to be displayed.`;
|
|
53
|
-
} });
|
|
54
|
-
}
|
|
55
|
-
}),
|
|
56
|
-
createComponent(FunctionDeclaration, {
|
|
57
|
-
"export": true,
|
|
58
|
-
name: "showHelp",
|
|
59
|
-
get doc() {
|
|
60
|
-
return `Display help information for the ${command.path ? `${command.title} command` : `${getAppTitle(context, true)} application`}.`;
|
|
61
|
-
},
|
|
62
|
-
get children() {
|
|
63
|
-
return createComponent(Show, {
|
|
64
|
-
get when() {
|
|
65
|
-
return !command.isVirtual;
|
|
66
|
-
},
|
|
67
|
-
get fallback() {
|
|
68
|
-
return createComponent(VirtualCommandHelpDisplay, {
|
|
69
|
-
get options() {
|
|
70
|
-
return Object.values(command.options);
|
|
71
|
-
},
|
|
72
|
-
get commands() {
|
|
73
|
-
return command.children ?? {};
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
get children() {
|
|
78
|
-
return createComponent(CommandHelpDisplay, { command });
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}),
|
|
83
|
-
createComponent(Spacing, {}),
|
|
84
|
-
createComponent(Show, {
|
|
85
|
-
get when() {
|
|
86
|
-
return Boolean(children);
|
|
87
|
-
},
|
|
88
|
-
children
|
|
89
|
-
})
|
|
90
|
-
];
|
|
91
|
-
}
|
|
92
|
-
}));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
//#endregion
|
|
96
|
-
export { HelpBuiltin };
|
|
1
|
+
import{CommandHelpDisplay as e,VirtualCommandHelpDisplay as t}from"./display.mjs";import{createComponent as n,memo as r,mergeProps as i}from"@alloy-js/core/jsx-runtime";import{Show as a,splitProps as o}from"@alloy-js/core";import{getAppTitle as s,isDynamicPathSegment as c}from"@shell-shock/core/plugin-utils";import l from"defu";import{Spacing as u}from"@powerlines/plugin-alloy/core/components/spacing";import{usePowerlines as d}from"@powerlines/plugin-alloy/core/contexts/context";import{FunctionDeclaration as f}from"@alloy-js/typescript";import{TSDoc as p,TSDocRemarks as m}from"@powerlines/plugin-alloy/typescript";import{BuiltinFile as h}from"@powerlines/plugin-alloy/typescript/components/builtin-file";import{joinPaths as g}from"@stryke/path";function _(_){let[{command:v,children:y},b]=o(_,[`command`,`children`]),x=d();return n(h,i({get id(){return g(`help`,...v.segments.filter(e=>!c(e)))},get description(){return r(()=>!!v.path)()?`A collection of utility functions that assist in displaying help information for the ${v.title} command.`:`A collection of utility functions that assist in displaying help information for the ${s(x,!0)} command-line interface application.`}},b,{get builtinImports(){return l(b.builtinImports??{},{utils:[`isUnicodeSupported`],console:[`splitText`,`writeLine`,`inlineCode`,`textColors`,`inverse`,`bold`,`help`,`table`,`link`]})},get children(){return[n(p,{get heading(){return`Utility functions for displaying help information for the ${v.path?`${v.title} command`:`${s(x,!0)} application`}.`},get children(){return n(m,{get children(){return`This module contains utility functions that assist in displaying help information for the ${v.path?`${v.title} command`:`${s(x,!0)} application`}. The main function exported by this module is the \`showHelp\` function, which can be used to display help information for the specified command or application. This function can be called from within the command's handler or from any other part of the application where help information needs to be displayed.`}})}}),n(f,{export:!0,name:`showHelp`,get doc(){return`Display help information for the ${v.path?`${v.title} command`:`${s(x,!0)} application`}.`},get children(){return n(a,{get when(){return!v.isVirtual},get fallback(){return n(t,{get options(){return Object.values(v.options)},get commands(){return v.children??{}}})},get children(){return n(e,{command:v})}})}}),n(u,{}),n(a,{get when(){return!!y},children:y})]}}))}export{_ as HelpBuiltin};
|
|
97
2
|
//# sourceMappingURL=help-builtin.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-builtin.mjs","names":[],"sources":["../../src/components/help-builtin.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 { Show, splitProps } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { TSDoc, TSDocRemarks } from \"@powerlines/plugin-alloy/typescript\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport {\n getAppTitle,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport defu from \"defu\";\nimport type { HelpPluginContext } from \"../types\";\nimport { CommandHelpDisplay, VirtualCommandHelpDisplay } from \"./display\";\n\nexport interface HelpBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {\n /**\n * The command to generate the `help` function declaration for.\n */\n command: CommandTree;\n}\n\n/**\n * A built-in help module for Shell Shock.\n */\nexport function HelpBuiltin(props: HelpBuiltinProps) {\n const [{ command, children }, rest] = splitProps(props, [\n \"command\",\n \"children\"\n ]);\n const context = usePowerlines<HelpPluginContext>();\n\n return (\n <BuiltinFile\n id={joinPaths(\n \"help\",\n ...command.segments.filter(segment => !isDynamicPathSegment(segment))\n )}\n description={\n command.path\n ? `A collection of utility functions that assist in displaying help information for the ${\n command.title\n } command.`\n : `A collection of utility functions that assist in displaying help information for the ${getAppTitle(\n context,\n true\n )} command-line interface application.`\n }\n {...rest}\n builtinImports={defu(rest.builtinImports ?? {}, {\n utils: [\"isUnicodeSupported\"],\n console: [\n \"splitText\",\n \"writeLine\",\n \"inlineCode\",\n \"textColors\",\n \"inverse\",\n \"bold\",\n \"help\",\n \"table\",\n \"link\"\n ]\n })}>\n <TSDoc\n heading={`Utility functions for displaying help information for the ${\n command.path\n ? `${command.title} command`\n : `${getAppTitle(context, true)} application`\n }.`}>\n <TSDocRemarks>\n {`This module contains utility functions that assist in displaying help information for the ${\n command.path\n ? `${command.title} command`\n : `${getAppTitle(context, true)} application`\n }. The main function exported by this module is the \\`showHelp\\` function, which can be used to display help information for the specified command or application. This function can be called from within the command's handler or from any other part of the application where help information needs to be displayed.`}\n </TSDocRemarks>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"showHelp\"\n doc={`Display help information for the ${\n command.path\n ? `${command.title} command`\n : `${getAppTitle(context, true)} application`\n }.`}>\n <Show\n when={!command.isVirtual}\n fallback={\n <VirtualCommandHelpDisplay\n options={Object.values(command.options)}\n commands={command.children ?? {}}\n />\n }>\n <CommandHelpDisplay command={command} />\n </Show>\n </FunctionDeclaration>\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"help-builtin.mjs","names":[],"sources":["../../src/components/help-builtin.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 { Show, splitProps } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { TSDoc, TSDocRemarks } from \"@powerlines/plugin-alloy/typescript\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport {\n getAppTitle,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport defu from \"defu\";\nimport type { HelpPluginContext } from \"../types\";\nimport { CommandHelpDisplay, VirtualCommandHelpDisplay } from \"./display\";\n\nexport interface HelpBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {\n /**\n * The command to generate the `help` function declaration for.\n */\n command: CommandTree;\n}\n\n/**\n * A built-in help module for Shell Shock.\n */\nexport function HelpBuiltin(props: HelpBuiltinProps) {\n const [{ command, children }, rest] = splitProps(props, [\n \"command\",\n \"children\"\n ]);\n const context = usePowerlines<HelpPluginContext>();\n\n return (\n <BuiltinFile\n id={joinPaths(\n \"help\",\n ...command.segments.filter(segment => !isDynamicPathSegment(segment))\n )}\n description={\n command.path\n ? `A collection of utility functions that assist in displaying help information for the ${\n command.title\n } command.`\n : `A collection of utility functions that assist in displaying help information for the ${getAppTitle(\n context,\n true\n )} command-line interface application.`\n }\n {...rest}\n builtinImports={defu(rest.builtinImports ?? {}, {\n utils: [\"isUnicodeSupported\"],\n console: [\n \"splitText\",\n \"writeLine\",\n \"inlineCode\",\n \"textColors\",\n \"inverse\",\n \"bold\",\n \"help\",\n \"table\",\n \"link\"\n ]\n })}>\n <TSDoc\n heading={`Utility functions for displaying help information for the ${\n command.path\n ? `${command.title} command`\n : `${getAppTitle(context, true)} application`\n }.`}>\n <TSDocRemarks>\n {`This module contains utility functions that assist in displaying help information for the ${\n command.path\n ? `${command.title} command`\n : `${getAppTitle(context, true)} application`\n }. The main function exported by this module is the \\`showHelp\\` function, which can be used to display help information for the specified command or application. This function can be called from within the command's handler or from any other part of the application where help information needs to be displayed.`}\n </TSDocRemarks>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"showHelp\"\n doc={`Display help information for the ${\n command.path\n ? `${command.title} command`\n : `${getAppTitle(context, true)} application`\n }.`}>\n <Show\n when={!command.isVirtual}\n fallback={\n <VirtualCommandHelpDisplay\n options={Object.values(command.options)}\n commands={command.children ?? {}}\n />\n }>\n <CommandHelpDisplay command={command} />\n </Show>\n </FunctionDeclaration>\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":"gvBAgCA,SAAc,EAAA,EAAoB,CAClC,GAAQ,CAAC,CAAA,UAET,YACE,GAAA,EAAgB,EAAA,CAAA,UAAA,WAAA,CAAA,CACV,EAAE,GAAW,CACnB,OAAA,EAAA,EAAA,EAAA,CACE,IAAA,IAAA,CACC,OAAI,EAAW,OAAS,GAAK,EAAM,SAAS,OAAA,GAAe,CAAA,EAAA,EAAA,CAAA,CAAA,EAE9D,IAAA,aAAoB,CACtB,OAAA,MAAA,CAAA,CAAA,EAAA,KAAA,EAAA,CAAA,wFAAA,EAAA,MAAA,WAAA,wFAAA,EAAA,EAAA,GAAA,CAAA,uCAEE,CAAA,EAAA,CACE,IAAC,gBAAoB,CACvB,OAAA,EAAA,EAAA,gBAAA,EAAA,CAAA,CACK,MAAQ,CAAC,qBAAmB,CAC3B,QAAG,CAAO,YAAa,YAAS,aAAkB,aAAA,UAAA,OAAA,OAAA,QAAA,OAAA,CACrD,CAAA,EAED,IAAA,UAAA,CACF,MAAM,CAAA,EAAwB,EAAA,eAEvB,MAAA,6DAAA,EAAA,KAAA,GAAA,EAAA,MAAA,UAAA,GAAA,EAAA,EAAA,GAAA,CAAA,cAAA,IAED,IAAE,UAAS,CACV,OAAK,EAAA,EAAA,CACH,IAAA,UAAgB,CACpB,MAAA,6FAAA,EAAA,KAAA,GAAA,EAAA,MAAA,UAAA,GAAA,EAAA,EAAA,GAAA,CAAA,cAAA,0TAEC,CAAA,EAED,CAAC,CAAE,EAAY,EAAA,CACd,OAAM,GACN,KAAM,WACN,IAAI,KAAE,CACJ,MAAI,oCAAA,EAAA,KAAA,GAAA,EAAA,MAAA,UAAA,GAAA,EAAA,EAAA,GAAA,CAAA,cAAA,IAER,IAAA,UAAA,CACI,OAAI,EAAA,EAAA,CACR,IAAA,MAAgB,CACR,MAAG,CAAA,EAAA,WAEN,IAAA,UAAU,CACV,OAAU,EAAA,EAAA,CACV,IAAA,SAAW,CACX,OAAW,OAAA,OAAA,EAAA,QAAA,EAEN,IAAA,UAAA,CACA,OAAA,EAAA,UAAA,EAAA,EAED,CAAA,EAEN,IAAA,UAAA,CACF,OAAA,EAAA,EAAA,CACkB,UACf,CAAA,EAEC,CAAC,EAEL,CAAC,CAAC,EAAY,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACb,IAAI,MAAK,CACP,MAAE,EAAQ,GAEF,WACX,CAAC,CAAC,EAEN,CAAC,CAAC"}
|
|
@@ -1,152 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
5
|
-
let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
|
|
6
|
-
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
7
|
-
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
8
|
-
let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
|
|
9
|
-
let _stryke_path = require("@stryke/path");
|
|
10
|
-
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
11
|
-
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
12
|
-
|
|
13
|
-
//#region src/components/help-command.tsx
|
|
14
|
-
/**
|
|
15
|
-
* A temporary placeholder component for the help command. The actual content of this component will be rendered in the `prepare` step of the help plugin, after the command list has been fully resolved. This is necessary to ensure that the help command's entry file is generated, and to avoid any issues with missing files or circular dependencies during the rendering process.
|
|
16
|
-
*/
|
|
17
|
-
function TemporaryHelpCommand() {
|
|
18
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
19
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
|
|
20
|
-
get path() {
|
|
21
|
-
return (0, _stryke_path.joinPaths)(context.entryPath, "help", "command.ts");
|
|
22
|
-
},
|
|
23
|
-
get children() {
|
|
24
|
-
return [
|
|
25
|
-
_alloy_js_core.code` // Temporary placeholder file to ensure the help command's entry file is generated. The actual content of this file will be rendered in the \`prepare\` step of this plugin, after the command list has been fully resolved. `,
|
|
26
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
27
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
28
|
-
heading: "Display command usage details and other useful information to the user.",
|
|
29
|
-
get children() {
|
|
30
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
31
|
-
name: "segments",
|
|
32
|
-
children: `The command segments for the command to show help for. This is used to determine which command's help information to display. If no segments are provided, general help information about the CLI application will be displayed.`
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}),
|
|
36
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
37
|
-
"export": true,
|
|
38
|
-
"default": true,
|
|
39
|
-
async: true,
|
|
40
|
-
name: "handler",
|
|
41
|
-
parameters: [{
|
|
42
|
-
name: "segments",
|
|
43
|
-
type: "string[]",
|
|
44
|
-
default: "[]"
|
|
45
|
-
}]
|
|
46
|
-
})
|
|
47
|
-
];
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* The Help command's handler wrapper for the Shell Shock project.
|
|
53
|
-
*/
|
|
54
|
-
function HelpCommand(props) {
|
|
55
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
56
|
-
const helpImports = (0, _alloy_js_core.computed)(() => props.segments ? props.segments.reduce((ret, segments) => {
|
|
57
|
-
ret[(0, _stryke_path.joinPaths)("help", ...segments)] = [{
|
|
58
|
-
name: "showHelp",
|
|
59
|
-
alias: `showHelp${segments.map((segment) => (0, _stryke_string_format_pascal_case.pascalCase)(segment.replace(/-/g, ""))).join("")}`
|
|
60
|
-
}];
|
|
61
|
-
return ret;
|
|
62
|
-
}, {}) : {});
|
|
63
|
-
const commandSegmentsList = props.segments ?? [];
|
|
64
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
|
|
65
|
-
get path() {
|
|
66
|
-
return (0, _stryke_path.joinPaths)(context.entryPath, "help", "command.ts");
|
|
67
|
-
},
|
|
68
|
-
imports: {
|
|
69
|
-
"node:os": "os",
|
|
70
|
-
"node:fs/promises": ["readFile", "writeFile"]
|
|
71
|
-
},
|
|
72
|
-
get builtinImports() {
|
|
73
|
-
return {
|
|
74
|
-
...helpImports.value,
|
|
75
|
-
help: ["showHelp"],
|
|
76
|
-
console: [
|
|
77
|
-
"splitText",
|
|
78
|
-
"writeLine",
|
|
79
|
-
"inlineCode",
|
|
80
|
-
"textColors",
|
|
81
|
-
"inverse",
|
|
82
|
-
"bold",
|
|
83
|
-
"help",
|
|
84
|
-
"table",
|
|
85
|
-
"link"
|
|
86
|
-
]
|
|
87
|
-
};
|
|
88
|
-
},
|
|
89
|
-
get children() {
|
|
90
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
91
|
-
heading: "Display command usage details and other useful information to the user.",
|
|
92
|
-
get children() {
|
|
93
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
94
|
-
name: "segments",
|
|
95
|
-
children: `The command segments for the command to show help for. This is used to determine which command's help information to display. If no segments are provided, general help information about the CLI application will be displayed.`
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
99
|
-
"export": true,
|
|
100
|
-
"default": true,
|
|
101
|
-
async: true,
|
|
102
|
-
name: "handler",
|
|
103
|
-
parameters: [{
|
|
104
|
-
name: "segments",
|
|
105
|
-
type: "string[]",
|
|
106
|
-
default: "[]"
|
|
107
|
-
}],
|
|
108
|
-
get children() {
|
|
109
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
110
|
-
get when() {
|
|
111
|
-
return commandSegmentsList.length > 0;
|
|
112
|
-
},
|
|
113
|
-
fallback: _alloy_js_core.code`showHelp(); `,
|
|
114
|
-
get children() {
|
|
115
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
116
|
-
each: commandSegmentsList,
|
|
117
|
-
doubleHardline: true,
|
|
118
|
-
children: (segments, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
119
|
-
when: index > 0,
|
|
120
|
-
get fallback() {
|
|
121
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
122
|
-
get condition() {
|
|
123
|
-
return _alloy_js_core.code`segments.join("/").toLowerCase() === "${segments.join("/").toLowerCase()}"`;
|
|
124
|
-
},
|
|
125
|
-
get children() {
|
|
126
|
-
return _alloy_js_core.code` showHelp${segments.map((segment) => (0, _stryke_string_format_pascal_case.pascalCase)(segment)).join("")}(); `;
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
},
|
|
130
|
-
get children() {
|
|
131
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
132
|
-
get condition() {
|
|
133
|
-
return _alloy_js_core.code`segments.join("/").toLowerCase() === "${segments.join("/").toLowerCase()}"`;
|
|
134
|
-
},
|
|
135
|
-
get children() {
|
|
136
|
-
return _alloy_js_core.code` showHelp${segments.map((segment) => (0, _stryke_string_format_pascal_case.pascalCase)(segment)).join("")}(); `;
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
})
|
|
141
|
-
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { children: _alloy_js_core.code`showHelp(); ` })];
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
})];
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
//#endregion
|
|
151
|
-
exports.HelpCommand = HelpCommand;
|
|
152
|
-
exports.TemporaryHelpCommand = TemporaryHelpCommand;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@powerlines/plugin-alloy/core/components`),r=require(`@powerlines/plugin-alloy/core/contexts/context`),i=require(`@alloy-js/typescript`),a=require(`@powerlines/plugin-alloy/typescript`),o=require(`@stryke/path`),s=require(`@powerlines/plugin-alloy/typescript/components/tsdoc`),c=require(`@stryke/string-format/pascal-case`);function l(){let c=(0,r.usePowerlines)();return(0,e.createComponent)(a.TypescriptFile,{get path(){return(0,o.joinPaths)(c.entryPath,`help`,`command.ts`)},get children(){return[t.code` // Temporary placeholder file to ensure the help command's entry file is generated. The actual content of this file will be rendered in the \`prepare\` step of this plugin, after the command list has been fully resolved. `,(0,e.createComponent)(n.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:`Display command usage details and other useful information to the user.`,get children(){return(0,e.createComponent)(s.TSDocParam,{name:`segments`,children:`The command segments for the command to show help for. This is used to determine which command's help information to display. If no segments are provided, general help information about the CLI application will be displayed.`})}}),(0,e.createComponent)(i.FunctionDeclaration,{export:!0,default:!0,async:!0,name:`handler`,parameters:[{name:`segments`,type:`string[]`,default:`[]`}]})]}})}function u(n){let l=(0,r.usePowerlines)(),u=(0,t.computed)(()=>n.segments?n.segments.reduce((e,t)=>(e[(0,o.joinPaths)(`help`,...t)]=[{name:`showHelp`,alias:`showHelp${t.map(e=>(0,c.pascalCase)(e.replace(/-/g,``))).join(``)}`}],e),{}):{}),d=n.segments??[];return(0,e.createComponent)(a.TypescriptFile,{get path(){return(0,o.joinPaths)(l.entryPath,`help`,`command.ts`)},imports:{"node:os":`os`,"node:fs/promises":[`readFile`,`writeFile`]},get builtinImports(){return{...u.value,help:[`showHelp`],console:[`splitText`,`writeLine`,`inlineCode`,`textColors`,`inverse`,`bold`,`help`,`table`,`link`]}},get children(){return[(0,e.createComponent)(s.TSDoc,{heading:`Display command usage details and other useful information to the user.`,get children(){return(0,e.createComponent)(s.TSDocParam,{name:`segments`,children:`The command segments for the command to show help for. This is used to determine which command's help information to display. If no segments are provided, general help information about the CLI application will be displayed.`})}}),(0,e.createComponent)(i.FunctionDeclaration,{export:!0,default:!0,async:!0,name:`handler`,parameters:[{name:`segments`,type:`string[]`,default:`[]`}],get children(){return(0,e.createComponent)(t.Show,{get when(){return d.length>0},fallback:t.code`showHelp(); `,get children(){return[(0,e.createComponent)(t.For,{each:d,doubleHardline:!0,children:(n,r)=>(0,e.createComponent)(t.Show,{when:r>0,get fallback(){return(0,e.createComponent)(i.IfStatement,{get condition(){return t.code`segments.join("/").toLowerCase() === "${n.join(`/`).toLowerCase()}"`},get children(){return t.code` showHelp${n.map(e=>(0,c.pascalCase)(e)).join(``)}(); `}})},get children(){return(0,e.createComponent)(i.ElseIfClause,{get condition(){return t.code`segments.join("/").toLowerCase() === "${n.join(`/`).toLowerCase()}"`},get children(){return t.code` showHelp${n.map(e=>(0,c.pascalCase)(e)).join(``)}(); `}})}})}),(0,e.createComponent)(i.ElseClause,{children:t.code`showHelp(); `})]}})}})]}})}exports.HelpCommand=u,exports.TemporaryHelpCommand=l;
|
|
@@ -1,150 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { For, Show, code, computed } from "@alloy-js/core";
|
|
3
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components";
|
|
4
|
-
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
5
|
-
import { ElseClause, ElseIfClause, FunctionDeclaration, IfStatement } from "@alloy-js/typescript";
|
|
6
|
-
import { TypescriptFile } from "@powerlines/plugin-alloy/typescript";
|
|
7
|
-
import { joinPaths } from "@stryke/path";
|
|
8
|
-
import { TSDoc as TSDoc$1, TSDocParam } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
9
|
-
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
10
|
-
|
|
11
|
-
//#region src/components/help-command.tsx
|
|
12
|
-
/**
|
|
13
|
-
* A temporary placeholder component for the help command. The actual content of this component will be rendered in the `prepare` step of the help plugin, after the command list has been fully resolved. This is necessary to ensure that the help command's entry file is generated, and to avoid any issues with missing files or circular dependencies during the rendering process.
|
|
14
|
-
*/
|
|
15
|
-
function TemporaryHelpCommand() {
|
|
16
|
-
const context = usePowerlines();
|
|
17
|
-
return createComponent(TypescriptFile, {
|
|
18
|
-
get path() {
|
|
19
|
-
return joinPaths(context.entryPath, "help", "command.ts");
|
|
20
|
-
},
|
|
21
|
-
get children() {
|
|
22
|
-
return [
|
|
23
|
-
code` // Temporary placeholder file to ensure the help command's entry file is generated. The actual content of this file will be rendered in the \`prepare\` step of this plugin, after the command list has been fully resolved. `,
|
|
24
|
-
createComponent(Spacing, {}),
|
|
25
|
-
createComponent(TSDoc$1, {
|
|
26
|
-
heading: "Display command usage details and other useful information to the user.",
|
|
27
|
-
get children() {
|
|
28
|
-
return createComponent(TSDocParam, {
|
|
29
|
-
name: "segments",
|
|
30
|
-
children: `The command segments for the command to show help for. This is used to determine which command's help information to display. If no segments are provided, general help information about the CLI application will be displayed.`
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}),
|
|
34
|
-
createComponent(FunctionDeclaration, {
|
|
35
|
-
"export": true,
|
|
36
|
-
"default": true,
|
|
37
|
-
async: true,
|
|
38
|
-
name: "handler",
|
|
39
|
-
parameters: [{
|
|
40
|
-
name: "segments",
|
|
41
|
-
type: "string[]",
|
|
42
|
-
default: "[]"
|
|
43
|
-
}]
|
|
44
|
-
})
|
|
45
|
-
];
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* The Help command's handler wrapper for the Shell Shock project.
|
|
51
|
-
*/
|
|
52
|
-
function HelpCommand(props) {
|
|
53
|
-
const context = usePowerlines();
|
|
54
|
-
const helpImports = computed(() => props.segments ? props.segments.reduce((ret, segments) => {
|
|
55
|
-
ret[joinPaths("help", ...segments)] = [{
|
|
56
|
-
name: "showHelp",
|
|
57
|
-
alias: `showHelp${segments.map((segment) => pascalCase(segment.replace(/-/g, ""))).join("")}`
|
|
58
|
-
}];
|
|
59
|
-
return ret;
|
|
60
|
-
}, {}) : {});
|
|
61
|
-
const commandSegmentsList = props.segments ?? [];
|
|
62
|
-
return createComponent(TypescriptFile, {
|
|
63
|
-
get path() {
|
|
64
|
-
return joinPaths(context.entryPath, "help", "command.ts");
|
|
65
|
-
},
|
|
66
|
-
imports: {
|
|
67
|
-
"node:os": "os",
|
|
68
|
-
"node:fs/promises": ["readFile", "writeFile"]
|
|
69
|
-
},
|
|
70
|
-
get builtinImports() {
|
|
71
|
-
return {
|
|
72
|
-
...helpImports.value,
|
|
73
|
-
help: ["showHelp"],
|
|
74
|
-
console: [
|
|
75
|
-
"splitText",
|
|
76
|
-
"writeLine",
|
|
77
|
-
"inlineCode",
|
|
78
|
-
"textColors",
|
|
79
|
-
"inverse",
|
|
80
|
-
"bold",
|
|
81
|
-
"help",
|
|
82
|
-
"table",
|
|
83
|
-
"link"
|
|
84
|
-
]
|
|
85
|
-
};
|
|
86
|
-
},
|
|
87
|
-
get children() {
|
|
88
|
-
return [createComponent(TSDoc$1, {
|
|
89
|
-
heading: "Display command usage details and other useful information to the user.",
|
|
90
|
-
get children() {
|
|
91
|
-
return createComponent(TSDocParam, {
|
|
92
|
-
name: "segments",
|
|
93
|
-
children: `The command segments for the command to show help for. This is used to determine which command's help information to display. If no segments are provided, general help information about the CLI application will be displayed.`
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}), createComponent(FunctionDeclaration, {
|
|
97
|
-
"export": true,
|
|
98
|
-
"default": true,
|
|
99
|
-
async: true,
|
|
100
|
-
name: "handler",
|
|
101
|
-
parameters: [{
|
|
102
|
-
name: "segments",
|
|
103
|
-
type: "string[]",
|
|
104
|
-
default: "[]"
|
|
105
|
-
}],
|
|
106
|
-
get children() {
|
|
107
|
-
return createComponent(Show, {
|
|
108
|
-
get when() {
|
|
109
|
-
return commandSegmentsList.length > 0;
|
|
110
|
-
},
|
|
111
|
-
fallback: code`showHelp(); `,
|
|
112
|
-
get children() {
|
|
113
|
-
return [createComponent(For, {
|
|
114
|
-
each: commandSegmentsList,
|
|
115
|
-
doubleHardline: true,
|
|
116
|
-
children: (segments, index) => createComponent(Show, {
|
|
117
|
-
when: index > 0,
|
|
118
|
-
get fallback() {
|
|
119
|
-
return createComponent(IfStatement, {
|
|
120
|
-
get condition() {
|
|
121
|
-
return code`segments.join("/").toLowerCase() === "${segments.join("/").toLowerCase()}"`;
|
|
122
|
-
},
|
|
123
|
-
get children() {
|
|
124
|
-
return code` showHelp${segments.map((segment) => pascalCase(segment)).join("")}(); `;
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
},
|
|
128
|
-
get children() {
|
|
129
|
-
return createComponent(ElseIfClause, {
|
|
130
|
-
get condition() {
|
|
131
|
-
return code`segments.join("/").toLowerCase() === "${segments.join("/").toLowerCase()}"`;
|
|
132
|
-
},
|
|
133
|
-
get children() {
|
|
134
|
-
return code` showHelp${segments.map((segment) => pascalCase(segment)).join("")}(); `;
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
})
|
|
139
|
-
}), createComponent(ElseClause, { children: code`showHelp(); ` })];
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
})];
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
//#endregion
|
|
149
|
-
export { HelpCommand, TemporaryHelpCommand };
|
|
1
|
+
import{createComponent as e}from"@alloy-js/core/jsx-runtime";import{For as t,Show as n,code as r,computed as i}from"@alloy-js/core";import{Spacing as a}from"@powerlines/plugin-alloy/core/components";import{usePowerlines as o}from"@powerlines/plugin-alloy/core/contexts/context";import{ElseClause as s,ElseIfClause as c,FunctionDeclaration as l,IfStatement as u}from"@alloy-js/typescript";import{TypescriptFile as d}from"@powerlines/plugin-alloy/typescript";import{joinPaths as f}from"@stryke/path";import{TSDoc as p,TSDocParam as m}from"@powerlines/plugin-alloy/typescript/components/tsdoc";import{pascalCase as h}from"@stryke/string-format/pascal-case";function g(){let t=o();return e(d,{get path(){return f(t.entryPath,`help`,`command.ts`)},get children(){return[r` // Temporary placeholder file to ensure the help command's entry file is generated. The actual content of this file will be rendered in the \`prepare\` step of this plugin, after the command list has been fully resolved. `,e(a,{}),e(p,{heading:`Display command usage details and other useful information to the user.`,get children(){return e(m,{name:`segments`,children:`The command segments for the command to show help for. This is used to determine which command's help information to display. If no segments are provided, general help information about the CLI application will be displayed.`})}}),e(l,{export:!0,default:!0,async:!0,name:`handler`,parameters:[{name:`segments`,type:`string[]`,default:`[]`}]})]}})}function _(a){let g=o(),_=i(()=>a.segments?a.segments.reduce((e,t)=>(e[f(`help`,...t)]=[{name:`showHelp`,alias:`showHelp${t.map(e=>h(e.replace(/-/g,``))).join(``)}`}],e),{}):{}),v=a.segments??[];return e(d,{get path(){return f(g.entryPath,`help`,`command.ts`)},imports:{"node:os":`os`,"node:fs/promises":[`readFile`,`writeFile`]},get builtinImports(){return{..._.value,help:[`showHelp`],console:[`splitText`,`writeLine`,`inlineCode`,`textColors`,`inverse`,`bold`,`help`,`table`,`link`]}},get children(){return[e(p,{heading:`Display command usage details and other useful information to the user.`,get children(){return e(m,{name:`segments`,children:`The command segments for the command to show help for. This is used to determine which command's help information to display. If no segments are provided, general help information about the CLI application will be displayed.`})}}),e(l,{export:!0,default:!0,async:!0,name:`handler`,parameters:[{name:`segments`,type:`string[]`,default:`[]`}],get children(){return e(n,{get when(){return v.length>0},fallback:r`showHelp(); `,get children(){return[e(t,{each:v,doubleHardline:!0,children:(t,i)=>e(n,{when:i>0,get fallback(){return e(u,{get condition(){return r`segments.join("/").toLowerCase() === "${t.join(`/`).toLowerCase()}"`},get children(){return r` showHelp${t.map(e=>h(e)).join(``)}(); `}})},get children(){return e(c,{get condition(){return r`segments.join("/").toLowerCase() === "${t.join(`/`).toLowerCase()}"`},get children(){return r` showHelp${t.map(e=>h(e)).join(``)}(); `}})}})}),e(s,{children:r`showHelp(); `})]}})}})]}})}export{_ as HelpCommand,g as TemporaryHelpCommand};
|
|
150
2
|
//# sourceMappingURL=help-command.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-command.mjs","names":[],"sources":["../../src/components/help-command.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 {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocParam\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { joinPaths } from \"@stryke/path\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport type { HelpPluginContext } from \"../types/plugin\";\n\n/**\n * A temporary placeholder component for the help command. The actual content of this component will be rendered in the `prepare` step of the help plugin, after the command list has been fully resolved. This is necessary to ensure that the help command's entry file is generated, and to avoid any issues with missing files or circular dependencies during the rendering process.\n */\nexport function TemporaryHelpCommand() {\n const context = usePowerlines<HelpPluginContext>();\n\n return (\n <TypescriptFile path={joinPaths(context.entryPath, \"help\", \"command.ts\")}>\n {code` // Temporary placeholder file to ensure the help command's entry file is generated. The actual content of this file will be rendered in the \\`prepare\\` step of this plugin, after the command list has been fully resolved. `}\n <Spacing />\n <TSDoc heading=\"Display command usage details and other useful information to the user.\">\n <TSDocParam name=\"segments\">\n {`The command segments for the command to show help for. This is used to determine which command's help information to display. If no segments are provided, general help information about the CLI application will be displayed.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n { name: \"segments\", type: \"string[]\", default: \"[]\" }\n ]}></FunctionDeclaration>\n </TypescriptFile>\n );\n}\n\nexport interface HelpCommandsProps {\n segments: string[][];\n}\n\n/**\n * The Help command's handler wrapper for the Shell Shock project.\n */\nexport function HelpCommand(props: HelpCommandsProps) {\n const context = usePowerlines<HelpPluginContext>();\n\n const helpImports = computed(() =>\n props.segments\n ? props.segments.reduce(\n (ret, segments) => {\n ret[joinPaths(\"help\", ...segments)] = [\n {\n name: \"showHelp\",\n alias: `showHelp${segments\n .map(segment => pascalCase(segment.replace(/-/g, \"\")))\n .join(\"\")}`\n }\n ];\n return ret;\n },\n {} as Record<string, { name: string; alias: string }[]>\n )\n : {}\n );\n\n const commandSegmentsList = props.segments ?? [];\n\n return (\n <TypescriptFile\n path={joinPaths(context.entryPath, \"help\", \"command.ts\")}\n imports={{\n \"node:os\": \"os\",\n \"node:fs/promises\": [\"readFile\", \"writeFile\"]\n }}\n builtinImports={{\n ...helpImports.value,\n help: [\"showHelp\"],\n console: [\n \"splitText\",\n \"writeLine\",\n \"inlineCode\",\n \"textColors\",\n \"inverse\",\n \"bold\",\n \"help\",\n \"table\",\n \"link\"\n ]\n }}>\n <TSDoc heading=\"Display command usage details and other useful information to the user.\">\n <TSDocParam name=\"segments\">\n {`The command segments for the command to show help for. This is used to determine which command's help information to display. If no segments are provided, general help information about the CLI application will be displayed.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[{ name: \"segments\", type: \"string[]\", default: \"[]\" }]}>\n <Show\n when={commandSegmentsList.length > 0}\n fallback={code`showHelp(); `}>\n <For each={commandSegmentsList} doubleHardline>\n {(segments, index) => (\n <Show\n when={index > 0}\n fallback={\n <IfStatement\n condition={code`segments.join(\"/\").toLowerCase() === \"${segments\n .join(\"/\")\n .toLowerCase()}\"`}>\n {code` showHelp${segments\n .map(segment => pascalCase(segment))\n .join(\"\")}(); `}\n </IfStatement>\n }>\n <ElseIfClause\n condition={code`segments.join(\"/\").toLowerCase() === \"${segments\n .join(\"/\")\n .toLowerCase()}\"`}>\n {code` showHelp${segments\n .map(segment => pascalCase(segment))\n .join(\"\")}(); `}\n </ElseIfClause>\n </Show>\n )}\n </For>\n <ElseClause>{code`showHelp(); `}</ElseClause>\n </Show>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"help-command.mjs","names":[],"sources":["../../src/components/help-command.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 {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocParam\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { joinPaths } from \"@stryke/path\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport type { HelpPluginContext } from \"../types/plugin\";\n\n/**\n * A temporary placeholder component for the help command. The actual content of this component will be rendered in the `prepare` step of the help plugin, after the command list has been fully resolved. This is necessary to ensure that the help command's entry file is generated, and to avoid any issues with missing files or circular dependencies during the rendering process.\n */\nexport function TemporaryHelpCommand() {\n const context = usePowerlines<HelpPluginContext>();\n\n return (\n <TypescriptFile path={joinPaths(context.entryPath, \"help\", \"command.ts\")}>\n {code` // Temporary placeholder file to ensure the help command's entry file is generated. The actual content of this file will be rendered in the \\`prepare\\` step of this plugin, after the command list has been fully resolved. `}\n <Spacing />\n <TSDoc heading=\"Display command usage details and other useful information to the user.\">\n <TSDocParam name=\"segments\">\n {`The command segments for the command to show help for. This is used to determine which command's help information to display. If no segments are provided, general help information about the CLI application will be displayed.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n { name: \"segments\", type: \"string[]\", default: \"[]\" }\n ]}></FunctionDeclaration>\n </TypescriptFile>\n );\n}\n\nexport interface HelpCommandsProps {\n segments: string[][];\n}\n\n/**\n * The Help command's handler wrapper for the Shell Shock project.\n */\nexport function HelpCommand(props: HelpCommandsProps) {\n const context = usePowerlines<HelpPluginContext>();\n\n const helpImports = computed(() =>\n props.segments\n ? props.segments.reduce(\n (ret, segments) => {\n ret[joinPaths(\"help\", ...segments)] = [\n {\n name: \"showHelp\",\n alias: `showHelp${segments\n .map(segment => pascalCase(segment.replace(/-/g, \"\")))\n .join(\"\")}`\n }\n ];\n return ret;\n },\n {} as Record<string, { name: string; alias: string }[]>\n )\n : {}\n );\n\n const commandSegmentsList = props.segments ?? [];\n\n return (\n <TypescriptFile\n path={joinPaths(context.entryPath, \"help\", \"command.ts\")}\n imports={{\n \"node:os\": \"os\",\n \"node:fs/promises\": [\"readFile\", \"writeFile\"]\n }}\n builtinImports={{\n ...helpImports.value,\n help: [\"showHelp\"],\n console: [\n \"splitText\",\n \"writeLine\",\n \"inlineCode\",\n \"textColors\",\n \"inverse\",\n \"bold\",\n \"help\",\n \"table\",\n \"link\"\n ]\n }}>\n <TSDoc heading=\"Display command usage details and other useful information to the user.\">\n <TSDocParam name=\"segments\">\n {`The command segments for the command to show help for. This is used to determine which command's help information to display. If no segments are provided, general help information about the CLI application will be displayed.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[{ name: \"segments\", type: \"string[]\", default: \"[]\" }]}>\n <Show\n when={commandSegmentsList.length > 0}\n fallback={code`showHelp(); `}>\n <For each={commandSegmentsList} doubleHardline>\n {(segments, index) => (\n <Show\n when={index > 0}\n fallback={\n <IfStatement\n condition={code`segments.join(\"/\").toLowerCase() === \"${segments\n .join(\"/\")\n .toLowerCase()}\"`}>\n {code` showHelp${segments\n .map(segment => pascalCase(segment))\n .join(\"\")}(); `}\n </IfStatement>\n }>\n <ElseIfClause\n condition={code`segments.join(\"/\").toLowerCase() === \"${segments\n .join(\"/\")\n .toLowerCase()}\"`}>\n {code` showHelp${segments\n .map(segment => pascalCase(segment))\n .join(\"\")}(); `}\n </ElseIfClause>\n </Show>\n )}\n </For>\n <ElseClause>{code`showHelp(); `}</ElseClause>\n </Show>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":"8oBA8BA,SAAE,GAAA,CACA,IAAM,EAAC,GAAwB,CACjC,OAAS,EAAkB,EAAa,CACxC,IAAQ,MAAC,CACH,OAAO,EAAC,EAAiB,UAAW,OAAO,aAAO,EAEtD,IAAA,UAAA,CACG,MAAA,CAAS,CAAC,iOAAqO,EAAiB,EAAQ,EAAA,CAAA,CAAA,EAAwB,EAAI,CACvS,QAAA,0EACK,IAAA,UAAS,CACR,OAAS,EAAe,EAAA,iBAEvB,SAAA,mOACJ,CAAA,EAEE,CAAA,CAAA,EAAS,EAAA,CACT,OAAM,GACL,QAAW,GACX,MAAO,GACP,KAAE,UACF,WAAK,CAAA,CACN,KAAA,WACC,KAAA,WACA,QAAA,KACA,CAAA,CACD,CAAC,CAAA,EAEL,CAAC,eAMJ,IAAO,EAAU,GAAA,CACf,EAAoB,MAAA,EAAA,SAAA,EAAA,SAAA,QAAA,EAAA,KACtB,EAAA,EAAA,OAAA,GAAA,EAAA,EAAA,CAAA,iBAEE,MAAA,WAAA,EAAA,IAAA,GAAA,EAAA,EAAA,QAAA,KAAA,GAAA,CAAA,CAAA,CAAA,KAAA,GAAA,GACC,CAAG,CACJ,GACF,EAAO,CAAA,CAAA,EAAA,CAAA,CACC,EAAU,EAAc,UAAA,EAAkB,aAEhD,IAAM,MAAA,CACJ,OAAM,EAAA,EAAA,UAAA,OAAA,aAAA,EAEN,QAAO,CACL,UAAU,KACV,mBAAQ,CAAA,WAAA,YAAA,CACT,CACD,IAAI,gBAAgB,CAClB,MAAO,CACL,GAAG,EAAY,MACf,KAAM,CAAA,WAAA,CACN,QAAK,CAAA,YAAA,YAAA,aAAA,aAAA,UAAA,OAAA,OAAA,QAAA,OAAA,CACN,EAEH,IAAI,UAAQ,CACV,MAAE,CAAA,EAAA,EAAA,CACA,QAAC,0EACN,IAAA,UAAA,aAEK,KAAA,uPAEC,CAAA,EAEH,CAAA,CAAI,EAAY,EAA2B,CAC3C,OAAS,GACP,QAAW,GACX,MAAM,GACP,KAAA,UACD,WAAc,CAAC,CACX,KAAC,WACH,KAAQ,WACR,QAAS,KACR,CAAC,CACF,IAAG,UAAU,CACX,OAAC,EAAW,EAAA,CACX,IAAA,MAAW,CACX,OAAQ,EAAA,OAAA,GAER,SAAK,CAAA,eACL,IAAK,UAAC,CACN,MAAI,CAAA,EAAA,EAAA,CACP,KAAA,EACA,eAAA,GACK,UAAS,EAAe,IAAO,EAAkB,EAAO,CAC5D,KAAe,EAAE,EACV,IAAA,UAAiB,CACb,OAAA,EAAA,EAAA,CACP,IAAA,WAAA,CACN,MAAA,EAAA,yCAAA,EAAA,KAAA,IAAA,CAAA,aAAA,CAAA,IAEC,IAAA,UAAA,CACA,MAAA,EAAA,YAAA,EAAA,IAAA,GAAA,EAAA,EAAA,CAAA,CAAA,KAAA,GAAA,CAAA,OAEa,CAAC,EAEN,IAAA,UAAA,CACI,OAAK,EAAc,EAAA,CAClB,IAAA,WAAA,CACG,MAAO,EAAG,yCAAA,EAAA,KAAA,IAAA,CAAA,aAAA,CAAA,IAEZ,IAAA,UAAS,CACP,MAAC,EAAA,YAAA,EAAA,IAAA,GAAA,EAAA,EAAA,CAAA,CAAA,KAAA,GAAA,CAAA,OAEL,CAAA,EAEH,CAAC,CACH,CAAC,CAAE,EAAkB,EAAC,CACrB,SAAU,CAAC,eACZ,CAAC,CAAC,EAEN,CAAC,EAEL,CAAC,CAAC,EAEN,CAAC"}
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_components_display = require('./display.cjs');
|
|
3
|
-
const require_components_help_builtin = require('./help-builtin.cjs');
|
|
4
|
-
const require_components_help_command = require('./help-command.cjs');
|
|
5
|
-
|
|
6
|
-
exports.BaseHelpDisplay = require_components_display.BaseHelpDisplay;
|
|
7
|
-
exports.CommandHelpDisplay = require_components_display.CommandHelpDisplay;
|
|
8
|
-
exports.HelpBuiltin = require_components_help_builtin.HelpBuiltin;
|
|
9
|
-
exports.HelpCommand = require_components_help_command.HelpCommand;
|
|
10
|
-
exports.HelpCommandsDisplay = require_components_display.HelpCommandsDisplay;
|
|
11
|
-
exports.HelpOptionsDisplay = require_components_display.HelpOptionsDisplay;
|
|
12
|
-
exports.HelpUsageDisplay = require_components_display.HelpUsageDisplay;
|
|
13
|
-
exports.TemporaryHelpCommand = require_components_help_command.TemporaryHelpCommand;
|
|
14
|
-
exports.VirtualCommandHelpDisplay = require_components_display.VirtualCommandHelpDisplay;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./display.cjs`),t=require(`./help-builtin.cjs`),n=require(`./help-command.cjs`);exports.BaseHelpDisplay=e.BaseHelpDisplay,exports.CommandHelpDisplay=e.CommandHelpDisplay,exports.HelpBuiltin=t.HelpBuiltin,exports.HelpCommand=n.HelpCommand,exports.HelpCommandsDisplay=e.HelpCommandsDisplay,exports.HelpOptionsDisplay=e.HelpOptionsDisplay,exports.HelpUsageDisplay=e.HelpUsageDisplay,exports.TemporaryHelpCommand=n.TemporaryHelpCommand,exports.VirtualCommandHelpDisplay=e.VirtualCommandHelpDisplay;
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { HelpBuiltin } from "./help-builtin.mjs";
|
|
3
|
-
import { HelpCommand, TemporaryHelpCommand } from "./help-command.mjs";
|
|
4
|
-
|
|
5
|
-
export { BaseHelpDisplay, CommandHelpDisplay, HelpBuiltin, HelpCommand, HelpCommandsDisplay, HelpOptionsDisplay, HelpUsageDisplay, TemporaryHelpCommand, VirtualCommandHelpDisplay };
|
|
1
|
+
import{BaseHelpDisplay as e,CommandHelpDisplay as t,HelpCommandsDisplay as n,HelpOptionsDisplay as r,HelpUsageDisplay as i,VirtualCommandHelpDisplay as a}from"./display.mjs";import{HelpBuiltin as o}from"./help-builtin.mjs";import{HelpCommand as s,TemporaryHelpCommand as c}from"./help-command.mjs";export{e as BaseHelpDisplay,t as CommandHelpDisplay,o as HelpBuiltin,s as HelpCommand,n as HelpCommandsDisplay,r as HelpOptionsDisplay,i as HelpUsageDisplay,c as TemporaryHelpCommand,a as VirtualCommandHelpDisplay};
|