@shell-shock/plugin-help 0.2.26 → 0.2.29
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 +29 -1
- package/dist/components/display.cjs +276 -18
- package/dist/components/display.d.cts +6 -7
- package/dist/components/display.d.cts.map +1 -1
- package/dist/components/display.d.mts +6 -7
- package/dist/components/display.d.mts.map +1 -1
- package/dist/components/display.mjs +270 -18
- package/dist/components/display.mjs.map +1 -1
- package/dist/components/help-builtin.cjs +99 -1
- package/dist/components/help-builtin.d.cts +1 -2
- package/dist/components/help-builtin.d.cts.map +1 -1
- package/dist/components/help-builtin.d.mts +2 -3
- package/dist/components/help-builtin.d.mts.map +1 -1
- package/dist/components/help-builtin.mjs +96 -1
- package/dist/components/help-builtin.mjs.map +1 -1
- package/dist/components/help-command.cjs +151 -1
- package/dist/components/help-command.d.cts +3 -5
- package/dist/components/help-command.d.cts.map +1 -1
- package/dist/components/help-command.d.mts +3 -5
- package/dist/components/help-command.d.mts.map +1 -1
- package/dist/components/help-command.mjs +149 -1
- package/dist/components/help-command.mjs.map +1 -1
- package/dist/components/index.cjs +14 -1
- package/dist/components/index.mjs +5 -1
- package/dist/index.cjs +97 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +91 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +18 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-builtin.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"help-builtin.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1,151 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
4
|
+
let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
|
|
5
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
6
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
7
|
+
let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
|
|
8
|
+
let _stryke_path = require("@stryke/path");
|
|
9
|
+
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
10
|
+
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
11
|
+
|
|
12
|
+
//#region src/components/help-command.tsx
|
|
13
|
+
/**
|
|
14
|
+
* 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.
|
|
15
|
+
*/
|
|
16
|
+
function TemporaryHelpCommand() {
|
|
17
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
18
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
|
|
19
|
+
get path() {
|
|
20
|
+
return (0, _stryke_path.joinPaths)(context.entryPath, "help", "command.ts");
|
|
21
|
+
},
|
|
22
|
+
get children() {
|
|
23
|
+
return [
|
|
24
|
+
_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. `,
|
|
25
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
26
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
27
|
+
heading: "Display command usage details and other useful information to the user.",
|
|
28
|
+
get children() {
|
|
29
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
30
|
+
name: "segments",
|
|
31
|
+
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.`
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
36
|
+
"export": true,
|
|
37
|
+
"default": true,
|
|
38
|
+
async: true,
|
|
39
|
+
name: "handler",
|
|
40
|
+
parameters: [{
|
|
41
|
+
name: "segments",
|
|
42
|
+
type: "string[]",
|
|
43
|
+
default: "[]"
|
|
44
|
+
}]
|
|
45
|
+
})
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The Help command's handler wrapper for the Shell Shock project.
|
|
52
|
+
*/
|
|
53
|
+
function HelpCommand(props) {
|
|
54
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
55
|
+
const helpImports = (0, _alloy_js_core.computed)(() => props.commands ? props.commands.reduce((ret, segments) => {
|
|
56
|
+
ret[(0, _stryke_path.joinPaths)("help", ...segments)] = [{
|
|
57
|
+
name: "showHelp",
|
|
58
|
+
alias: `showHelp${segments.map((segment) => (0, _stryke_string_format_pascal_case.pascalCase)(segment.replace(/-/g, ""))).join("")}`
|
|
59
|
+
}];
|
|
60
|
+
return ret;
|
|
61
|
+
}, {}) : {});
|
|
62
|
+
const commandSegmentsList = props.commands ?? [];
|
|
63
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
|
|
64
|
+
get path() {
|
|
65
|
+
return (0, _stryke_path.joinPaths)(context.entryPath, "help", "command.ts");
|
|
66
|
+
},
|
|
67
|
+
imports: {
|
|
68
|
+
"node:os": "os",
|
|
69
|
+
"node:fs/promises": ["readFile", "writeFile"]
|
|
70
|
+
},
|
|
71
|
+
get builtinImports() {
|
|
72
|
+
return {
|
|
73
|
+
...helpImports.value,
|
|
74
|
+
help: ["showHelp"],
|
|
75
|
+
console: [
|
|
76
|
+
"splitText",
|
|
77
|
+
"writeLine",
|
|
78
|
+
"inlineCode",
|
|
79
|
+
"textColors",
|
|
80
|
+
"inverse",
|
|
81
|
+
"bold",
|
|
82
|
+
"help",
|
|
83
|
+
"table",
|
|
84
|
+
"link"
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
get children() {
|
|
89
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
90
|
+
heading: "Display command usage details and other useful information to the user.",
|
|
91
|
+
get children() {
|
|
92
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
93
|
+
name: "segments",
|
|
94
|
+
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.`
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
98
|
+
"export": true,
|
|
99
|
+
"default": true,
|
|
100
|
+
async: true,
|
|
101
|
+
name: "handler",
|
|
102
|
+
parameters: [{
|
|
103
|
+
name: "segments",
|
|
104
|
+
type: "string[]",
|
|
105
|
+
default: "[]"
|
|
106
|
+
}],
|
|
107
|
+
get children() {
|
|
108
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
109
|
+
get when() {
|
|
110
|
+
return commandSegmentsList.length > 0;
|
|
111
|
+
},
|
|
112
|
+
fallback: _alloy_js_core.code`showHelp(); `,
|
|
113
|
+
get children() {
|
|
114
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
115
|
+
each: commandSegmentsList,
|
|
116
|
+
doubleHardline: true,
|
|
117
|
+
children: (segments, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
118
|
+
when: index > 0,
|
|
119
|
+
get fallback() {
|
|
120
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
121
|
+
get condition() {
|
|
122
|
+
return _alloy_js_core.code`segments.join("/").toLowerCase() === "${segments.join("/").toLowerCase()}"`;
|
|
123
|
+
},
|
|
124
|
+
get children() {
|
|
125
|
+
return _alloy_js_core.code` showHelp${segments.map((segment) => (0, _stryke_string_format_pascal_case.pascalCase)(segment)).join("")}(); `;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
get children() {
|
|
130
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
131
|
+
get condition() {
|
|
132
|
+
return _alloy_js_core.code`segments.join("/").toLowerCase() === "${segments.join("/").toLowerCase()}"`;
|
|
133
|
+
},
|
|
134
|
+
get children() {
|
|
135
|
+
return _alloy_js_core.code` showHelp${segments.map((segment) => (0, _stryke_string_format_pascal_case.pascalCase)(segment)).join("")}(); `;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { children: _alloy_js_core.code`showHelp(); ` })];
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
})];
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
//#endregion
|
|
150
|
+
exports.HelpCommand = HelpCommand;
|
|
151
|
+
exports.TemporaryHelpCommand = TemporaryHelpCommand;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
|
|
3
1
|
//#region src/components/help-command.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* 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.
|
|
6
4
|
*/
|
|
7
|
-
declare function TemporaryHelpCommand():
|
|
5
|
+
declare function TemporaryHelpCommand(): import("@alloy-js/core").Children;
|
|
8
6
|
interface HelpCommandsProps {
|
|
9
|
-
|
|
7
|
+
commands: string[][];
|
|
10
8
|
}
|
|
11
9
|
/**
|
|
12
10
|
* The Help command's handler wrapper for the Shell Shock project.
|
|
13
11
|
*/
|
|
14
|
-
declare function HelpCommand(props: HelpCommandsProps):
|
|
12
|
+
declare function HelpCommand(props: HelpCommandsProps): import("@alloy-js/core").Children;
|
|
15
13
|
//#endregion
|
|
16
14
|
export { HelpCommand, HelpCommandsProps, TemporaryHelpCommand };
|
|
17
15
|
//# sourceMappingURL=help-command.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-command.d.cts","names":[],"sources":["../../src/components/help-command.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"help-command.d.cts","names":[],"sources":["../../src/components/help-command.tsx"],"mappings":";;AAuCA;;iBAAgB,oBAAA,6BAAoB,QAAA;AAAA,UAwBnB,iBAAA;EACf,QAAQ;AAAA;;;;iBAMM,WAAA,CAAY,KAAA,EAAO,iBAAiB,4BAAA,QAAA"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
|
|
3
1
|
//#region src/components/help-command.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* 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.
|
|
6
4
|
*/
|
|
7
|
-
declare function TemporaryHelpCommand():
|
|
5
|
+
declare function TemporaryHelpCommand(): import("@alloy-js/core").Children;
|
|
8
6
|
interface HelpCommandsProps {
|
|
9
|
-
|
|
7
|
+
commands: string[][];
|
|
10
8
|
}
|
|
11
9
|
/**
|
|
12
10
|
* The Help command's handler wrapper for the Shell Shock project.
|
|
13
11
|
*/
|
|
14
|
-
declare function HelpCommand(props: HelpCommandsProps):
|
|
12
|
+
declare function HelpCommand(props: HelpCommandsProps): import("@alloy-js/core").Children;
|
|
15
13
|
//#endregion
|
|
16
14
|
export { HelpCommand, HelpCommandsProps, TemporaryHelpCommand };
|
|
17
15
|
//# sourceMappingURL=help-command.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-command.d.mts","names":[],"sources":["../../src/components/help-command.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"help-command.d.mts","names":[],"sources":["../../src/components/help-command.tsx"],"mappings":""}
|
|
@@ -1,2 +1,150 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
|
|
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.commands ? props.commands.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.commands ?? [];
|
|
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 };
|
|
2
150
|
//# sourceMappingURL=help-command.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-command.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"help-command.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
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 +1,5 @@
|
|
|
1
|
-
import{BaseHelpDisplay
|
|
1
|
+
import { BaseHelpDisplay, CommandHelpDisplay, HelpCommandsDisplay, HelpOptionsDisplay, HelpUsageDisplay, VirtualCommandHelpDisplay } from "./display.mjs";
|
|
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 };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,97 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_components_help_builtin = require('./components/help-builtin.cjs');
|
|
4
|
+
const require_components_help_command = require('./components/help-command.cjs');
|
|
5
|
+
require('./components/index.cjs');
|
|
6
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
7
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
8
|
+
let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
|
|
9
|
+
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
10
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
11
|
+
let _shell_shock_plugin_console = require("@shell-shock/plugin-console");
|
|
12
|
+
_shell_shock_plugin_console = require_runtime.__toESM(_shell_shock_plugin_console);
|
|
13
|
+
let _shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
|
|
14
|
+
_shell_shock_plugin_theme = require_runtime.__toESM(_shell_shock_plugin_theme);
|
|
15
|
+
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
16
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
17
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
18
|
+
let defu = require("defu");
|
|
19
|
+
defu = require_runtime.__toESM(defu);
|
|
20
|
+
|
|
21
|
+
//#region src/index.tsx
|
|
22
|
+
/**
|
|
23
|
+
* The Help - Shell Shock plugin to add a help command to the application.
|
|
24
|
+
*/
|
|
25
|
+
const plugin = (options = {}) => {
|
|
26
|
+
return [
|
|
27
|
+
...(0, _shell_shock_plugin_theme.default)(options.theme),
|
|
28
|
+
...(0, _shell_shock_plugin_console.default)(options.console),
|
|
29
|
+
{
|
|
30
|
+
name: "shell-shock/help",
|
|
31
|
+
enforce: "post",
|
|
32
|
+
config() {
|
|
33
|
+
this.debug("Providing default configuration for the Shell Shock `help` plugin.");
|
|
34
|
+
return { help: (0, defu.default)({ command: options.command === false ? false : (0, _stryke_type_checks_is_set_string.isSetString)(options.command) ? { name: options.command } : { name: "help" } }, options, { builtins: true }) };
|
|
35
|
+
},
|
|
36
|
+
async configResolved() {
|
|
37
|
+
this.debug("Adding the Help command to the application context.");
|
|
38
|
+
if (this.config.help.command !== false) {
|
|
39
|
+
this.inputs ??= [];
|
|
40
|
+
if (this.inputs.some((input) => input.name === this.config.help.command.name)) this.info("The `help` command already exists in the commands list. If you would like the help command to be managed by the `@shell-shock/plugin-help` package, please remove or rename the command.");
|
|
41
|
+
else this.inputs.push({
|
|
42
|
+
id: this.config.help.command.name,
|
|
43
|
+
path: this.config.help.command.name,
|
|
44
|
+
segments: [this.config.help.command.name],
|
|
45
|
+
title: "Help",
|
|
46
|
+
icon: "🛈",
|
|
47
|
+
tags: ["Utility"],
|
|
48
|
+
description: `Display command usage details and other useful information to the user.`,
|
|
49
|
+
entry: {
|
|
50
|
+
file: (0, _stryke_path_join.joinPaths)(this.entryPath, "help", "index.ts"),
|
|
51
|
+
input: { file: (0, _stryke_path_join.joinPaths)(this.entryPath, "help", "command.ts") }
|
|
52
|
+
},
|
|
53
|
+
virtual: false,
|
|
54
|
+
...this.config.help.command
|
|
55
|
+
});
|
|
56
|
+
await (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_command.TemporaryHelpCommand, {}));
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
prepare: {
|
|
60
|
+
order: "post",
|
|
61
|
+
async handler() {
|
|
62
|
+
const _self$ = this;
|
|
63
|
+
const commands = await (0, _shell_shock_core_plugin_utils.getCommandList)(this);
|
|
64
|
+
this.debug(`Rendering \`help\` built-ins for each of the ${commands.length} command modules.`);
|
|
65
|
+
const segments = (0, _alloy_js_core.computed)(() => (0, _stryke_helpers_get_unique.getUniqueBy)(commands.map((command) => command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)).filter((segment) => segment.length > 0)), (segments) => segments.join("/")).filter((segments) => segments.length > 0).sort((a, b) => a.join("/").localeCompare(b.join("/"))));
|
|
66
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
67
|
+
get when() {
|
|
68
|
+
return _self$.config.help.builtins !== false;
|
|
69
|
+
},
|
|
70
|
+
get children() {
|
|
71
|
+
return [
|
|
72
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_builtin.HelpBuiltin, { get command() {
|
|
73
|
+
return (0, _shell_shock_core_plugin_utils.computeBin)(_self$);
|
|
74
|
+
} }),
|
|
75
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
76
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
77
|
+
get each() {
|
|
78
|
+
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
79
|
+
},
|
|
80
|
+
doubleHardline: true,
|
|
81
|
+
children: (command) => (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_builtin.HelpBuiltin, { command })
|
|
82
|
+
}),
|
|
83
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_command.HelpCommand, { get commands() {
|
|
84
|
+
return segments.value;
|
|
85
|
+
} })
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
})]);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
exports.default = plugin;
|
|
97
|
+
exports.plugin = plugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -7,5 +7,5 @@ import { Plugin } from "powerlines";
|
|
|
7
7
|
*/
|
|
8
8
|
declare const plugin: <TContext extends HelpPluginContext = HelpPluginContext>(options?: HelpPluginOptions) => Plugin<TContext>[];
|
|
9
9
|
//#endregion
|
|
10
|
-
export { HelpPluginContext, HelpPluginOptions, HelpPluginResolvedConfig, HelpPluginUserConfig, plugin as default, plugin };
|
|
10
|
+
export { type HelpPluginContext, type HelpPluginOptions, type HelpPluginResolvedConfig, type HelpPluginUserConfig, plugin as default, plugin };
|
|
11
11
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -7,5 +7,5 @@ import { Plugin } from "powerlines";
|
|
|
7
7
|
*/
|
|
8
8
|
declare const plugin: <TContext extends HelpPluginContext = HelpPluginContext>(options?: HelpPluginOptions) => Plugin<TContext>[];
|
|
9
9
|
//#endregion
|
|
10
|
-
export { HelpPluginContext, HelpPluginOptions, HelpPluginResolvedConfig, HelpPluginUserConfig, plugin as default, plugin };
|
|
10
|
+
export { type HelpPluginContext, type HelpPluginOptions, type HelpPluginResolvedConfig, type HelpPluginUserConfig, plugin as default, plugin };
|
|
11
11
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":""}
|