@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
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,92 @@
|
|
|
1
|
-
import{HelpBuiltin
|
|
1
|
+
import { HelpBuiltin } from "./components/help-builtin.mjs";
|
|
2
|
+
import { HelpCommand, TemporaryHelpCommand } from "./components/help-command.mjs";
|
|
3
|
+
import "./components/index.mjs";
|
|
4
|
+
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
5
|
+
import { For, Show, computed } from "@alloy-js/core";
|
|
6
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components";
|
|
7
|
+
import { render } from "@powerlines/plugin-alloy/render";
|
|
8
|
+
import { computeBin, getCommandList, isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
9
|
+
import console from "@shell-shock/plugin-console";
|
|
10
|
+
import theme from "@shell-shock/plugin-theme";
|
|
11
|
+
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
12
|
+
import { joinPaths } from "@stryke/path/join";
|
|
13
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
14
|
+
import defu from "defu";
|
|
15
|
+
|
|
16
|
+
//#region src/index.tsx
|
|
17
|
+
/**
|
|
18
|
+
* The Help - Shell Shock plugin to add a help command to the application.
|
|
19
|
+
*/
|
|
20
|
+
const plugin = (options = {}) => {
|
|
21
|
+
return [
|
|
22
|
+
...theme(options.theme),
|
|
23
|
+
...console(options.console),
|
|
24
|
+
{
|
|
25
|
+
name: "shell-shock/help",
|
|
26
|
+
enforce: "post",
|
|
27
|
+
config() {
|
|
28
|
+
this.debug("Providing default configuration for the Shell Shock `help` plugin.");
|
|
29
|
+
return { help: defu({ command: options.command === false ? false : isSetString(options.command) ? { name: options.command } : { name: "help" } }, options, { builtins: true }) };
|
|
30
|
+
},
|
|
31
|
+
async configResolved() {
|
|
32
|
+
this.debug("Adding the Help command to the application context.");
|
|
33
|
+
if (this.config.help.command !== false) {
|
|
34
|
+
this.inputs ??= [];
|
|
35
|
+
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.");
|
|
36
|
+
else this.inputs.push({
|
|
37
|
+
id: this.config.help.command.name,
|
|
38
|
+
path: this.config.help.command.name,
|
|
39
|
+
segments: [this.config.help.command.name],
|
|
40
|
+
title: "Help",
|
|
41
|
+
icon: "🛈",
|
|
42
|
+
tags: ["Utility"],
|
|
43
|
+
description: `Display command usage details and other useful information to the user.`,
|
|
44
|
+
entry: {
|
|
45
|
+
file: joinPaths(this.entryPath, "help", "index.ts"),
|
|
46
|
+
input: { file: joinPaths(this.entryPath, "help", "command.ts") }
|
|
47
|
+
},
|
|
48
|
+
virtual: false,
|
|
49
|
+
...this.config.help.command
|
|
50
|
+
});
|
|
51
|
+
await render(this, createComponent(TemporaryHelpCommand, {}));
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
prepare: {
|
|
55
|
+
order: "post",
|
|
56
|
+
async handler() {
|
|
57
|
+
const _self$ = this;
|
|
58
|
+
const commands = await getCommandList(this);
|
|
59
|
+
this.debug(`Rendering \`help\` built-ins for each of the ${commands.length} command modules.`);
|
|
60
|
+
const segments = computed(() => getUniqueBy(commands.map((command) => command.segments.filter((segment) => !isDynamicPathSegment(segment)).filter((segment) => segment.length > 0)), (segments) => segments.join("/")).filter((segments) => segments.length > 0).sort((a, b) => a.join("/").localeCompare(b.join("/"))));
|
|
61
|
+
return render(this, [createComponent(Show, {
|
|
62
|
+
get when() {
|
|
63
|
+
return _self$.config.help.builtins !== false;
|
|
64
|
+
},
|
|
65
|
+
get children() {
|
|
66
|
+
return [
|
|
67
|
+
createComponent(HelpBuiltin, { get command() {
|
|
68
|
+
return computeBin(_self$);
|
|
69
|
+
} }),
|
|
70
|
+
createComponent(Spacing, {}),
|
|
71
|
+
createComponent(For, {
|
|
72
|
+
get each() {
|
|
73
|
+
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
74
|
+
},
|
|
75
|
+
doubleHardline: true,
|
|
76
|
+
children: (command) => createComponent(HelpBuiltin, { command })
|
|
77
|
+
}),
|
|
78
|
+
createComponent(HelpCommand, { get commands() {
|
|
79
|
+
return segments.value;
|
|
80
|
+
} })
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
})]);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
export { plugin as default, plugin };
|
|
2
92
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":""}
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/plugin-help",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.29",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Shell Shock plugin to provide help and documentation for the local application's commands.",
|
|
6
6
|
"keywords": [
|
|
@@ -151,26 +151,26 @@
|
|
|
151
151
|
"typings": "dist/index.d.mts",
|
|
152
152
|
"files": ["dist/**/*"],
|
|
153
153
|
"dependencies": {
|
|
154
|
-
"@alloy-js/core": "0.23.
|
|
155
|
-
"@alloy-js/typescript": "0.23.0
|
|
156
|
-
"@powerlines/deepkit": "^0.
|
|
157
|
-
"@powerlines/plugin-alloy": "^0.26.
|
|
158
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
159
|
-
"@shell-shock/core": "
|
|
160
|
-
"@shell-shock/plugin-console": "
|
|
161
|
-
"@shell-shock/plugin-theme": "
|
|
162
|
-
"@stryke/helpers": "^0.10.
|
|
163
|
-
"@stryke/path": "^0.
|
|
164
|
-
"@stryke/string-format": "^0.17.
|
|
165
|
-
"@stryke/type-checks": "^0.6.
|
|
166
|
-
"@stryke/types": "^0.
|
|
154
|
+
"@alloy-js/core": "^0.23.1",
|
|
155
|
+
"@alloy-js/typescript": "^0.23.0",
|
|
156
|
+
"@powerlines/deepkit": "^0.9.78",
|
|
157
|
+
"@powerlines/plugin-alloy": "^0.26.217",
|
|
158
|
+
"@powerlines/plugin-plugin": "^0.12.536",
|
|
159
|
+
"@shell-shock/core": "0.17.11",
|
|
160
|
+
"@shell-shock/plugin-console": "0.2.15",
|
|
161
|
+
"@shell-shock/plugin-theme": "0.4.24",
|
|
162
|
+
"@stryke/helpers": "^0.10.24",
|
|
163
|
+
"@stryke/path": "^0.29.11",
|
|
164
|
+
"@stryke/string-format": "^0.17.26",
|
|
165
|
+
"@stryke/type-checks": "^0.6.17",
|
|
166
|
+
"@stryke/types": "^0.12.12",
|
|
167
167
|
"defu": "^6.1.7",
|
|
168
|
-
"powerlines": "^0.
|
|
168
|
+
"powerlines": "^0.47.124"
|
|
169
169
|
},
|
|
170
170
|
"devDependencies": {
|
|
171
|
-
"@powerlines/plugin-deepkit": "^0.11.
|
|
172
|
-
"@types/node": "^25.
|
|
171
|
+
"@powerlines/plugin-deepkit": "^0.11.467",
|
|
172
|
+
"@types/node": "^25.9.1"
|
|
173
173
|
},
|
|
174
174
|
"publishConfig": { "access": "public" },
|
|
175
|
-
"gitHead": "
|
|
175
|
+
"gitHead": "9401c1de122d800040306fc89ad1835930c1a826"
|
|
176
176
|
}
|