@shell-shock/plugin-help 0.2.24 → 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/README.md +1 -1
- 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
package/dist/index.cjs
CHANGED
|
@@ -1,98 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,
|
|
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
|
-
isVirtual: false,
|
|
54
|
-
source: "help-plugin",
|
|
55
|
-
...this.config.help.command
|
|
56
|
-
});
|
|
57
|
-
await (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_command.TemporaryHelpCommand, {}));
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
prepare: {
|
|
61
|
-
order: "post",
|
|
62
|
-
async handler() {
|
|
63
|
-
const _self$ = this;
|
|
64
|
-
const commands = await (0, _shell_shock_core_plugin_utils.getCommandList)(this);
|
|
65
|
-
this.debug(`Rendering \`help\` built-ins for each of the ${commands.length} command modules.`);
|
|
66
|
-
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("/"))));
|
|
67
|
-
return (0, _powerlines_plugin_alloy_render.render)(this, [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
68
|
-
get when() {
|
|
69
|
-
return _self$.config.help.builtins !== false;
|
|
70
|
-
},
|
|
71
|
-
get children() {
|
|
72
|
-
return [
|
|
73
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_builtin.HelpBuiltin, { get command() {
|
|
74
|
-
return (0, _shell_shock_core_plugin_utils.computeBin)(_self$);
|
|
75
|
-
} }),
|
|
76
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
77
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
78
|
-
get each() {
|
|
79
|
-
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
80
|
-
},
|
|
81
|
-
doubleHardline: true,
|
|
82
|
-
children: (command) => (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_builtin.HelpBuiltin, { command })
|
|
83
|
-
}),
|
|
84
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_command.HelpCommand, { get segments() {
|
|
85
|
-
return segments.value;
|
|
86
|
-
} })
|
|
87
|
-
];
|
|
88
|
-
}
|
|
89
|
-
})]);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
];
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
//#endregion
|
|
97
|
-
exports.default = plugin;
|
|
98
|
-
exports.plugin = plugin;
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./components/help-builtin.cjs`),n=require(`./components/help-command.cjs`);require(`./components/index.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/core`),a=require(`@powerlines/plugin-alloy/core/components`),o=require(`@powerlines/plugin-alloy/render`),s=require(`@shell-shock/core/plugin-utils`),c=require(`@shell-shock/plugin-console`);c=e.__toESM(c);let l=require(`@shell-shock/plugin-theme`);l=e.__toESM(l);let u=require(`@stryke/helpers/get-unique`),d=require(`@stryke/path/join`),f=require(`@stryke/type-checks/is-set-string`),p=require(`defu`);p=e.__toESM(p);const m=(e={})=>[...(0,l.default)(e.theme),...(0,c.default)(e.console),{name:`shell-shock:help`,enforce:`post`,config(){return this.debug("Providing default configuration for the Shell Shock `help` plugin."),{help:(0,p.default)({command:e.command===!1?!1:(0,f.isSetString)(e.command)?{name:e.command}:{name:`help`}},e,{builtins:!0})}},async configResolved(){this.debug(`Adding the Help command to the application context.`),this.config.help.command!==!1&&(this.inputs??=[],this.inputs.some(e=>e.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."):this.inputs.push({id:this.config.help.command.name,path:this.config.help.command.name,segments:[this.config.help.command.name],title:`Help`,icon:`🛈`,tags:[`Utility`],description:`Display command usage details and other useful information to the user.`,entry:{file:(0,d.joinPaths)(this.entryPath,`help`,`index.ts`),input:{file:(0,d.joinPaths)(this.entryPath,`help`,`command.ts`)}},isVirtual:!1,source:`help-plugin`,...this.config.help.command}),await(0,o.render)(this,(0,r.createComponent)(n.TemporaryHelpCommand,{})))},prepare:{order:`post`,async handler(){let e=this,c=await(0,s.getCommandList)(this);this.debug(`Rendering \`help\` built-ins for each of the ${c.length} command modules.`);let l=(0,i.computed)(()=>(0,u.getUniqueBy)(c.map(e=>e.segments.filter(e=>!(0,s.isDynamicPathSegment)(e)).filter(e=>e.length>0)),e=>e.join(`/`)).filter(e=>e.length>0).sort((e,t)=>e.join(`/`).localeCompare(t.join(`/`))));return(0,o.render)(this,[(0,r.createComponent)(i.Show,{get when(){return e.config.help.builtins!==!1},get children(){return[(0,r.createComponent)(t.HelpBuiltin,{get command(){return(0,s.computeBin)(e)}}),(0,r.createComponent)(a.Spacing,{}),(0,r.createComponent)(i.For,{get each(){return c.sort((e,t)=>e.name.localeCompare(t.name))},doubleHardline:!0,children:e=>(0,r.createComponent)(t.HelpBuiltin,{command:e})}),(0,r.createComponent)(n.HelpCommand,{get segments(){return l.value}})]}})])}}}];exports.default=m,exports.plugin=m;
|
package/dist/index.mjs
CHANGED
|
@@ -1,93 +1,2 @@
|
|
|
1
|
-
import
|
|
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
|
-
isVirtual: false,
|
|
49
|
-
source: "help-plugin",
|
|
50
|
-
...this.config.help.command
|
|
51
|
-
});
|
|
52
|
-
await render(this, createComponent(TemporaryHelpCommand, {}));
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
prepare: {
|
|
56
|
-
order: "post",
|
|
57
|
-
async handler() {
|
|
58
|
-
const _self$ = this;
|
|
59
|
-
const commands = await getCommandList(this);
|
|
60
|
-
this.debug(`Rendering \`help\` built-ins for each of the ${commands.length} command modules.`);
|
|
61
|
-
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("/"))));
|
|
62
|
-
return render(this, [createComponent(Show, {
|
|
63
|
-
get when() {
|
|
64
|
-
return _self$.config.help.builtins !== false;
|
|
65
|
-
},
|
|
66
|
-
get children() {
|
|
67
|
-
return [
|
|
68
|
-
createComponent(HelpBuiltin, { get command() {
|
|
69
|
-
return computeBin(_self$);
|
|
70
|
-
} }),
|
|
71
|
-
createComponent(Spacing, {}),
|
|
72
|
-
createComponent(For, {
|
|
73
|
-
get each() {
|
|
74
|
-
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
75
|
-
},
|
|
76
|
-
doubleHardline: true,
|
|
77
|
-
children: (command) => createComponent(HelpBuiltin, { command })
|
|
78
|
-
}),
|
|
79
|
-
createComponent(HelpCommand, { get segments() {
|
|
80
|
-
return segments.value;
|
|
81
|
-
} })
|
|
82
|
-
];
|
|
83
|
-
}
|
|
84
|
-
})]);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
];
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
//#endregion
|
|
92
|
-
export { plugin as default, plugin };
|
|
1
|
+
import{HelpBuiltin as e}from"./components/help-builtin.mjs";import{HelpCommand as t,TemporaryHelpCommand as n}from"./components/help-command.mjs";import"./components/index.mjs";import{createComponent as r}from"@alloy-js/core/jsx-runtime";import{For as i,Show as a,computed as o}from"@alloy-js/core";import{Spacing as s}from"@powerlines/plugin-alloy/core/components";import{render as c}from"@powerlines/plugin-alloy/render";import{computeBin as l,getCommandList as u,isDynamicPathSegment as d}from"@shell-shock/core/plugin-utils";import f from"@shell-shock/plugin-console";import p from"@shell-shock/plugin-theme";import{getUniqueBy as m}from"@stryke/helpers/get-unique";import{joinPaths as h}from"@stryke/path/join";import{isSetString as g}from"@stryke/type-checks/is-set-string";import _ from"defu";const v=(v={})=>[...p(v.theme),...f(v.console),{name:`shell-shock:help`,enforce:`post`,config(){return this.debug("Providing default configuration for the Shell Shock `help` plugin."),{help:_({command:v.command===!1?!1:g(v.command)?{name:v.command}:{name:`help`}},v,{builtins:!0})}},async configResolved(){this.debug(`Adding the Help command to the application context.`),this.config.help.command!==!1&&(this.inputs??=[],this.inputs.some(e=>e.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."):this.inputs.push({id:this.config.help.command.name,path:this.config.help.command.name,segments:[this.config.help.command.name],title:`Help`,icon:`🛈`,tags:[`Utility`],description:`Display command usage details and other useful information to the user.`,entry:{file:h(this.entryPath,`help`,`index.ts`),input:{file:h(this.entryPath,`help`,`command.ts`)}},isVirtual:!1,source:`help-plugin`,...this.config.help.command}),await c(this,r(n,{})))},prepare:{order:`post`,async handler(){let n=this,f=await u(this);this.debug(`Rendering \`help\` built-ins for each of the ${f.length} command modules.`);let p=o(()=>m(f.map(e=>e.segments.filter(e=>!d(e)).filter(e=>e.length>0)),e=>e.join(`/`)).filter(e=>e.length>0).sort((e,t)=>e.join(`/`).localeCompare(t.join(`/`))));return c(this,[r(a,{get when(){return n.config.help.builtins!==!1},get children(){return[r(e,{get command(){return l(n)}}),r(s,{}),r(i,{get each(){return f.sort((e,t)=>e.name.localeCompare(t.name))},doubleHardline:!0,children:t=>r(e,{command:t})}),r(t,{get segments(){return p.value}})]}})])}}}];export{v as default,v as plugin};
|
|
93
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed, For, Show } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport {\n computeBin,\n getCommandList,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport type { CommandConfig } from \"@shell-shock/core/types/command\";\nimport console from \"@shell-shock/plugin-console\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type { Plugin } from \"powerlines\";\nimport { HelpBuiltin, HelpCommand, TemporaryHelpCommand } from \"./components\";\nimport type { HelpPluginContext, HelpPluginOptions } from \"./types/plugin\";\n\nexport type * from \"./types\";\n\n/**\n * The Help - Shell Shock plugin to add a help command to the application.\n */\nexport const plugin = <TContext extends HelpPluginContext = HelpPluginContext>(\n options: HelpPluginOptions = {}\n): Plugin<TContext>[] => {\n return [\n ...theme<TContext>(options.theme),\n ...console<TContext>(options.console),\n {\n name: \"shell-shock:help\",\n enforce: \"post\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `help` plugin.\"\n );\n\n return {\n help: defu(\n {\n command:\n options.command === false\n ? false\n : isSetString(options.command)\n ? { name: options.command }\n : { name: \"help\" }\n },\n options,\n {\n builtins: true\n }\n )\n };\n },\n async configResolved() {\n this.debug(\"Adding the Help command to the application context.\");\n\n if (this.config.help.command !== false) {\n this.inputs ??= [];\n if (\n this.inputs.some(\n input =>\n input.name === (this.config.help.command as CommandConfig).name\n )\n ) {\n this.info(\n \"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.\"\n );\n } else {\n this.inputs.push({\n id: this.config.help.command.name,\n path: this.config.help.command.name,\n segments: [this.config.help.command.name],\n title: \"Help\",\n icon: \"🛈\",\n tags: [\"Utility\"],\n description: `Display command usage details and other useful information to the user.`,\n entry: {\n file: joinPaths(this.entryPath, \"help\", \"index.ts\"),\n input: {\n file: joinPaths(this.entryPath, \"help\", \"command.ts\")\n }\n },\n isVirtual: false,\n source: \"help-plugin\",\n ...this.config.help.command\n });\n }\n\n await render(this, <TemporaryHelpCommand />);\n }\n },\n prepare: {\n order: \"post\",\n async handler() {\n const commands = await getCommandList(this);\n this.debug(\n `Rendering \\`help\\` built-ins for each of the ${\n commands.length\n } command modules.`\n );\n\n const segments = computed(() =>\n getUniqueBy(\n commands.map(command =>\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .filter(segment => segment.length > 0)\n ),\n segments => segments.join(\"/\")\n )\n .filter(segments => segments.length > 0)\n .sort((a, b) => a.join(\"/\").localeCompare(b.join(\"/\")))\n );\n\n return render(\n this,\n <>\n <Show when={this.config.help.builtins !== false}>\n <HelpBuiltin command={computeBin(this)} />\n <Spacing />\n <For\n each={commands.sort((a, b) => a.name.localeCompare(b.name))}\n doubleHardline>\n {command => <HelpBuiltin command={command} />}\n </For>\n <HelpCommand segments={segments.value} />\n </Show>\n </>\n );\n }\n }\n }\n ];\n};\n\nexport default plugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed, For, Show } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport {\n computeBin,\n getCommandList,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport type { CommandConfig } from \"@shell-shock/core/types/command\";\nimport console from \"@shell-shock/plugin-console\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type { Plugin } from \"powerlines\";\nimport { HelpBuiltin, HelpCommand, TemporaryHelpCommand } from \"./components\";\nimport type { HelpPluginContext, HelpPluginOptions } from \"./types/plugin\";\n\nexport type * from \"./types\";\n\n/**\n * The Help - Shell Shock plugin to add a help command to the application.\n */\nexport const plugin = <TContext extends HelpPluginContext = HelpPluginContext>(\n options: HelpPluginOptions = {}\n): Plugin<TContext>[] => {\n return [\n ...theme<TContext>(options.theme),\n ...console<TContext>(options.console),\n {\n name: \"shell-shock:help\",\n enforce: \"post\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `help` plugin.\"\n );\n\n return {\n help: defu(\n {\n command:\n options.command === false\n ? false\n : isSetString(options.command)\n ? { name: options.command }\n : { name: \"help\" }\n },\n options,\n {\n builtins: true\n }\n )\n };\n },\n async configResolved() {\n this.debug(\"Adding the Help command to the application context.\");\n\n if (this.config.help.command !== false) {\n this.inputs ??= [];\n if (\n this.inputs.some(\n (input: CommandConfig) =>\n input.name === (this.config.help.command as CommandConfig).name\n )\n ) {\n this.info(\n \"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.\"\n );\n } else {\n this.inputs.push({\n id: this.config.help.command.name,\n path: this.config.help.command.name,\n segments: [this.config.help.command.name],\n title: \"Help\",\n icon: \"🛈\",\n tags: [\"Utility\"],\n description: `Display command usage details and other useful information to the user.`,\n entry: {\n file: joinPaths(this.entryPath, \"help\", \"index.ts\"),\n input: {\n file: joinPaths(this.entryPath, \"help\", \"command.ts\")\n }\n },\n isVirtual: false,\n source: \"help-plugin\",\n ...this.config.help.command\n });\n }\n\n await render(this, <TemporaryHelpCommand />);\n }\n },\n prepare: {\n order: \"post\",\n async handler() {\n const commands = await getCommandList(this);\n this.debug(\n `Rendering \\`help\\` built-ins for each of the ${\n commands.length\n } command modules.`\n );\n\n const segments = computed(() =>\n getUniqueBy(\n commands.map(command =>\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .filter(segment => segment.length > 0)\n ),\n segments => segments.join(\"/\")\n )\n .filter(segments => segments.length > 0)\n .sort((a, b) => a.join(\"/\").localeCompare(b.join(\"/\")))\n );\n\n return render(\n this,\n <>\n <Show when={this.config.help.builtins !== false}>\n <HelpBuiltin command={computeBin(this)} />\n <Spacing />\n <For\n each={commands.sort((a, b) => a.name.localeCompare(b.name))}\n doubleHardline>\n {command => <HelpBuiltin command={command} />}\n </For>\n <HelpCommand segments={segments.value} />\n </Show>\n </>\n );\n }\n }\n }\n ];\n};\n\nexport default plugin;\n"],"mappings":"gyBAiCA,MAAa,GAAU,EAAM,EAAA,GACpB,CAAA,GAAA,EAAA,EAAa,MAAW,CAAE,GAAA,EAAA,EAAA,QAA2B,CAAE,CAChE,KAAO,kCAEP,QAAa,CAEX,wFAAA,CACK,KAAO,EAAK,CACjB,QAAA,EAAA,UAAA,GAAA,GAAA,EAAA,EAAA,QAAA,CAAA,CACU,KAAC,EAAU,QACZ,CAAA,CACD,KAAQ,OACT,CACF,CAAA,EAAM,CACN,SAAQ,GACX,CAAA,CACE,EAEF,MAAE,gBAAS,CACT,KAAE,MAAK,sDAAK,CACR,KAAC,OAAU,KAAA,UAAQ,KACrB,KAAC,SAAA,EAAA,6DAED,KAAO,KAAA,2LAAA,CAEL,KAAE,OAAA,KAAA,CACA,GAAE,KAAO,OAAA,KAAA,QAAA,KACT,KAAI,KAAO,OAAC,KAAW,QAAC,KACxB,SAAQ,CAAA,KAAA,OAAA,KAAA,QAAA,KAAA,CACR,MAAO,OACP,KAAM,KACN,KAAM,CAAC,UAAU,CACjB,YAAC,0EACD,MAAO,CACP,KAAA,EAAA,KAAA,UAAA,OAAA,WAAA,CACE,MAAA,CACF,KAAA,EAAA,KAAA,UAAA,OAAA,aAAA,CACF,CACD,CACF,UAAA,GACK,OAAA,cACA,GAAC,KAAO,OAAO,KAAI,UAGvB,MAAM,EAAO,KAAM,EAAC,EAAA,EAAA,CAAA,CAAA,GAGxB,QAAS,CACP,MAAO,OACP,MAAM,SAAA,CACJ,IAAI,EAAA,KACA,EAAS,MAAA,EAAA,KAAA,CACb,KAAK,MAAM,gDAA8C,EAAS,OAAS,mBAAe,CAC1F,IAAK,EAAA,MAAA,EAAA,EAAA,IAAA,GAAA,EAAA,SAAA,OAAA,GAAA,CAAA,EAAA,EAAA,CAAA,CAAA,OAAA,GAAA,EAAA,OAAA,EAAA,CAAA,CAAA,GAAA,EAAA,KAAA,IAAA,CAAA,CAAA,OAAA,GAAA,EAAA,OAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,KAAA,IAAA,CAAA,cAAA,EAAA,KAAA,IAAA,CAAA,CAAA,CAAA,CACL,OAAI,EAAK,KAAA,CAAA,EAAA,EAAA,CACP,IAAE,MAAK,CACL,OAAM,EAAK,OAAO,KAAK,WAAY,IAErC,IAAI,UAAW,CACb,MAAO,CAAC,EAAO,EAAA,CACb,IAAI,SAAM,CACV,OAAQ,EAAS,EAAA,EAElB,CAAC,CAAA,EAAO,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACP,IAAE,MAAM,CACN,OAAO,EAAA,MAAA,EAAA,IAAA,EAAA,KAAA,cAAA,EAAA,KAAA,CAAA,EAET,eAAE,GACF,SAAC,GAAA,EAAA,EAAA,CACU,UACX,CAAA,CACD,CAAC,CAAE,EAAkB,EAAA,CACpB,IAAA,UAAA,CACJ,OAAA,EAAA,OAEA,CAAA,CAAK,EAER,CAAA,CAAA,CAAA,EAEF,CACF,CAAC"}
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export{};
|
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.26",
|
|
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": [
|
|
@@ -153,24 +153,24 @@
|
|
|
153
153
|
"dependencies": {
|
|
154
154
|
"@alloy-js/core": "0.23.0-dev.8",
|
|
155
155
|
"@alloy-js/typescript": "0.23.0-dev.4",
|
|
156
|
-
"@powerlines/deepkit": "^0.8.
|
|
157
|
-
"@powerlines/plugin-alloy": "^0.26.
|
|
158
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
159
|
-
"@shell-shock/core": "^0.17.
|
|
160
|
-
"@shell-shock/plugin-console": "^0.2.
|
|
161
|
-
"@shell-shock/plugin-theme": "^0.4.
|
|
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.11.
|
|
156
|
+
"@powerlines/deepkit": "^0.8.49",
|
|
157
|
+
"@powerlines/plugin-alloy": "^0.26.67",
|
|
158
|
+
"@powerlines/plugin-plugin": "^0.12.399",
|
|
159
|
+
"@shell-shock/core": "^0.17.8",
|
|
160
|
+
"@shell-shock/plugin-console": "^0.2.12",
|
|
161
|
+
"@shell-shock/plugin-theme": "^0.4.21",
|
|
162
|
+
"@stryke/helpers": "^0.10.11",
|
|
163
|
+
"@stryke/path": "^0.28.1",
|
|
164
|
+
"@stryke/string-format": "^0.17.12",
|
|
165
|
+
"@stryke/type-checks": "^0.6.4",
|
|
166
|
+
"@stryke/types": "^0.11.6",
|
|
167
167
|
"defu": "^6.1.7",
|
|
168
|
-
"powerlines": "^0.
|
|
168
|
+
"powerlines": "^0.44.12"
|
|
169
169
|
},
|
|
170
170
|
"devDependencies": {
|
|
171
|
-
"@powerlines/plugin-deepkit": "^0.11.
|
|
171
|
+
"@powerlines/plugin-deepkit": "^0.11.330",
|
|
172
172
|
"@types/node": "^25.6.0"
|
|
173
173
|
},
|
|
174
174
|
"publishConfig": { "access": "public" },
|
|
175
|
-
"gitHead": "
|
|
175
|
+
"gitHead": "832c19e668deb4d29b5e0219a7708d111790f607"
|
|
176
176
|
}
|