@shell-shock/plugin-help 0.1.2
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/LICENSE +201 -0
- package/README.md +264 -0
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/components/display.cjs +260 -0
- package/dist/components/display.d.cts +105 -0
- package/dist/components/display.d.cts.map +1 -0
- package/dist/components/display.d.mts +105 -0
- package/dist/components/display.d.mts.map +1 -0
- package/dist/components/display.mjs +254 -0
- package/dist/components/display.mjs.map +1 -0
- package/dist/components/help-builtin.cjs +113 -0
- package/dist/components/help-builtin.d.cts +22 -0
- package/dist/components/help-builtin.d.cts.map +1 -0
- package/dist/components/help-builtin.d.mts +22 -0
- package/dist/components/help-builtin.d.mts.map +1 -0
- package/dist/components/help-builtin.mjs +110 -0
- package/dist/components/help-builtin.mjs.map +1 -0
- package/dist/components/help-command.cjs +97 -0
- package/dist/components/help-command.d.cts +10 -0
- package/dist/components/help-command.d.cts.map +1 -0
- package/dist/components/help-command.d.mts +10 -0
- package/dist/components/help-command.d.mts.map +1 -0
- package/dist/components/help-command.mjs +96 -0
- package/dist/components/help-command.mjs.map +1 -0
- package/dist/components/index.cjs +14 -0
- package/dist/components/index.d.cts +4 -0
- package/dist/components/index.d.mts +4 -0
- package/dist/components/index.mjs +5 -0
- package/dist/index.cjs +105 -0
- package/dist/index.d.cts +11 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +100 -0
- package/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.cjs +17 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs +17 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.cjs +38 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs +38 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs +33 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs +34 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs +40 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs +41 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.cjs +17 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs +17 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.cjs +20 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs +21 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.cjs +12 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs +12 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.cjs +20 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs +21 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.cjs +19 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs +20 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.cjs +12 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs +12 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.cjs +8 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs +8 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs.map +1 -0
- package/dist/types/index.cjs +0 -0
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/plugin.cjs +0 -0
- package/dist/types/plugin.d.cts +61 -0
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +61 -0
- package/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/plugin.mjs +1 -0
- package/package.json +177 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
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_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_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
10
|
+
let _powerlines_plugin_alloy_core = require("@powerlines/plugin-alloy/core");
|
|
11
|
+
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
12
|
+
|
|
13
|
+
//#region src/components/help-command.tsx
|
|
14
|
+
/**
|
|
15
|
+
* The Help command's handler wrapper for the Shell Shock project.
|
|
16
|
+
*/
|
|
17
|
+
function HelpCommand() {
|
|
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
|
+
imports: {
|
|
24
|
+
"node:os": ["os"],
|
|
25
|
+
"node:fs/promises": ["readFile", "writeFile"]
|
|
26
|
+
},
|
|
27
|
+
builtinImports: { console: [
|
|
28
|
+
"colors",
|
|
29
|
+
"writeLine",
|
|
30
|
+
"success",
|
|
31
|
+
"warn",
|
|
32
|
+
"stripAnsi"
|
|
33
|
+
] },
|
|
34
|
+
get children() {
|
|
35
|
+
return [
|
|
36
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Options for the Help command." }),
|
|
37
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
38
|
+
"export": true,
|
|
39
|
+
name: "HelpOptions",
|
|
40
|
+
get children() {
|
|
41
|
+
return [
|
|
42
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
43
|
+
heading: "Whether to help to the latest version.",
|
|
44
|
+
get children() {
|
|
45
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `If set to \`true\`, the command will attempt to help to the latest version. This option takes precedence over the \`version\` option.` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
|
|
46
|
+
get type() {
|
|
47
|
+
return _powerlines_deepkit_vendor_type.ReflectionKind.boolean;
|
|
48
|
+
},
|
|
49
|
+
defaultValue: false
|
|
50
|
+
})];
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
53
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
54
|
+
name: "latest",
|
|
55
|
+
optional: true,
|
|
56
|
+
type: "boolean"
|
|
57
|
+
}),
|
|
58
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
59
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
60
|
+
heading: "A specific application version to help to.",
|
|
61
|
+
get children() {
|
|
62
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The command will attempt to help to the specified version. The version should be a valid semantic version string, or \`latest\` to help to the latest version.` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
|
|
63
|
+
get type() {
|
|
64
|
+
return _powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
65
|
+
},
|
|
66
|
+
defaultValue: "latest"
|
|
67
|
+
})];
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
71
|
+
name: "version",
|
|
72
|
+
optional: true,
|
|
73
|
+
type: "string"
|
|
74
|
+
})
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
79
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Handler logic for the \\`help\\` command." }),
|
|
80
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
81
|
+
"export": true,
|
|
82
|
+
"default": true,
|
|
83
|
+
async: true,
|
|
84
|
+
name: "handler",
|
|
85
|
+
parameters: [{
|
|
86
|
+
name: "options",
|
|
87
|
+
type: "HelpOptions"
|
|
88
|
+
}],
|
|
89
|
+
children: _alloy_js_core.code` return;`
|
|
90
|
+
})
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
exports.HelpCommand = HelpCommand;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
//#region src/components/help-command.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The Help command's handler wrapper for the Shell Shock project.
|
|
6
|
+
*/
|
|
7
|
+
declare function HelpCommand(): _alloy_js_core0.Children;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { HelpCommand };
|
|
10
|
+
//# sourceMappingURL=help-command.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-command.d.cts","names":[],"sources":["../../src/components/help-command.tsx"],"mappings":";;;;;;iBAyCgB,WAAA,CAAA,GAAW,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
//#region src/components/help-command.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The Help command's handler wrapper for the Shell Shock project.
|
|
6
|
+
*/
|
|
7
|
+
declare function HelpCommand(): _alloy_js_core0.Children;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { HelpCommand };
|
|
10
|
+
//# sourceMappingURL=help-command.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-command.d.mts","names":[],"sources":["../../src/components/help-command.tsx"],"mappings":";;;;;;iBAyCgB,WAAA,CAAA,GAAW,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { code } from "@alloy-js/core";
|
|
3
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
4
|
+
import { FunctionDeclaration, InterfaceDeclaration } from "@alloy-js/typescript";
|
|
5
|
+
import { InterfaceMember, TypescriptFile } from "@powerlines/plugin-alloy/typescript";
|
|
6
|
+
import { joinPaths } from "@stryke/path";
|
|
7
|
+
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
8
|
+
import { Spacing } from "@powerlines/plugin-alloy/core";
|
|
9
|
+
import { TSDoc as TSDoc$1, TSDocDefaultValue, TSDocRemarks as TSDocRemarks$1 } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
10
|
+
|
|
11
|
+
//#region src/components/help-command.tsx
|
|
12
|
+
/**
|
|
13
|
+
* The Help command's handler wrapper for the Shell Shock project.
|
|
14
|
+
*/
|
|
15
|
+
function HelpCommand() {
|
|
16
|
+
const context = usePowerlines();
|
|
17
|
+
return createComponent(TypescriptFile, {
|
|
18
|
+
get path() {
|
|
19
|
+
return joinPaths(context.entryPath, "help", "command.ts");
|
|
20
|
+
},
|
|
21
|
+
imports: {
|
|
22
|
+
"node:os": ["os"],
|
|
23
|
+
"node:fs/promises": ["readFile", "writeFile"]
|
|
24
|
+
},
|
|
25
|
+
builtinImports: { console: [
|
|
26
|
+
"colors",
|
|
27
|
+
"writeLine",
|
|
28
|
+
"success",
|
|
29
|
+
"warn",
|
|
30
|
+
"stripAnsi"
|
|
31
|
+
] },
|
|
32
|
+
get children() {
|
|
33
|
+
return [
|
|
34
|
+
createComponent(TSDoc$1, { heading: "Options for the Help command." }),
|
|
35
|
+
createComponent(InterfaceDeclaration, {
|
|
36
|
+
"export": true,
|
|
37
|
+
name: "HelpOptions",
|
|
38
|
+
get children() {
|
|
39
|
+
return [
|
|
40
|
+
createComponent(TSDoc$1, {
|
|
41
|
+
heading: "Whether to help to the latest version.",
|
|
42
|
+
get children() {
|
|
43
|
+
return [createComponent(TSDocRemarks$1, { children: `If set to \`true\`, the command will attempt to help to the latest version. This option takes precedence over the \`version\` option.` }), createComponent(TSDocDefaultValue, {
|
|
44
|
+
get type() {
|
|
45
|
+
return ReflectionKind.boolean;
|
|
46
|
+
},
|
|
47
|
+
defaultValue: false
|
|
48
|
+
})];
|
|
49
|
+
}
|
|
50
|
+
}),
|
|
51
|
+
createComponent(InterfaceMember, {
|
|
52
|
+
name: "latest",
|
|
53
|
+
optional: true,
|
|
54
|
+
type: "boolean"
|
|
55
|
+
}),
|
|
56
|
+
createComponent(Spacing, {}),
|
|
57
|
+
createComponent(TSDoc$1, {
|
|
58
|
+
heading: "A specific application version to help to.",
|
|
59
|
+
get children() {
|
|
60
|
+
return [createComponent(TSDocRemarks$1, { children: `The command will attempt to help to the specified version. The version should be a valid semantic version string, or \`latest\` to help to the latest version.` }), createComponent(TSDocDefaultValue, {
|
|
61
|
+
get type() {
|
|
62
|
+
return ReflectionKind.string;
|
|
63
|
+
},
|
|
64
|
+
defaultValue: "latest"
|
|
65
|
+
})];
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
createComponent(InterfaceMember, {
|
|
69
|
+
name: "version",
|
|
70
|
+
optional: true,
|
|
71
|
+
type: "string"
|
|
72
|
+
})
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
createComponent(Spacing, {}),
|
|
77
|
+
createComponent(TSDoc$1, { heading: "Handler logic for the \\`help\\` command." }),
|
|
78
|
+
createComponent(FunctionDeclaration, {
|
|
79
|
+
"export": true,
|
|
80
|
+
"default": true,
|
|
81
|
+
async: true,
|
|
82
|
+
name: "handler",
|
|
83
|
+
parameters: [{
|
|
84
|
+
name: "options",
|
|
85
|
+
type: "HelpOptions"
|
|
86
|
+
}],
|
|
87
|
+
children: code` return;`
|
|
88
|
+
})
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
//#endregion
|
|
95
|
+
export { HelpCommand };
|
|
96
|
+
//# sourceMappingURL=help-command.mjs.map
|
|
@@ -0,0 +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 } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n InterfaceDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n InterfaceMember,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TSDocRemarks\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { HelpPluginContext } from \"../types/plugin\";\n\n/**\n * The Help command's handler wrapper for the Shell Shock project.\n */\nexport function HelpCommand() {\n const context = usePowerlines<HelpPluginContext>();\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 console: [\"colors\", \"writeLine\", \"success\", \"warn\", \"stripAnsi\"]\n }}>\n <TSDoc heading=\"Options for the Help command.\" />\n <InterfaceDeclaration export name=\"HelpOptions\">\n <TSDoc heading=\"Whether to help to the latest version.\">\n <TSDocRemarks>{`If set to \\`true\\`, the command will attempt to help to the latest version. This option takes precedence over the \\`version\\` option.`}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.boolean}\n defaultValue={false}\n />\n </TSDoc>\n <InterfaceMember name=\"latest\" optional type=\"boolean\" />\n <Spacing />\n <TSDoc heading=\"A specific application version to help to.\">\n <TSDocRemarks>{`The command will attempt to help to the specified version. The version should be a valid semantic version string, or \\`latest\\` to help to the latest version.`}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue=\"latest\"\n />\n </TSDoc>\n <InterfaceMember name=\"version\" optional type=\"string\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`help\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[{ name: \"options\", type: \"HelpOptions\" }]}>\n {code` return;`}\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAgCA,SAAE,cAAiB;CACjB,MAAA,UAAA,eAAA;AACA,QAAO,gBAAkB,gBAAgB;EAC3C,IAAQ,OAAC;AACH,UAAO,UAAC,QAAiB,WAAW,QAAO,aAAO;;EAEtD,SAAA;GACI,WAAM,CAAA,KAAU;GACpB,oBAAA,CAAA,YAAA,YAAA;GACF;EACE,gBAAgB;;;;;;KAEhB;EACE,IAAC,WAAA;AACC,UAAM;IAAA,gBAAkB,SAAS,EACjC,SAAS,iCACR,CAAC;IAAC,gBAAgB,sBAAA;KACjB,UAAS;KACV,MAAA;KACD,IAAA,WAAgB;AACd,aAAS;OAAC,gBAAW,SAAa;QAClC,SAAA;QACI,IAAC,WAAS;AACf,gBAAA,CAAA,gBAAiC,gBAAa,EACtC,UAAS,yIACb,CAAA,EAAA,gBAAyB,mBAAc;UACvC,IAAA,OAAA;AACO,kBAAA,eAAsB;;UAE7B,cAAA;UACI,CAAA,CAAA;;QAEN,CAAA;OAAA,gBAAS,iBAAA;QACT,MAAM;QACJ,UAAA;QACA,MAAA;QACA,CAAC;OAAA,gBAAoB,SAAO,EAAA,CAAA;OAAA,gBAAA,SAAA;QAC3B,SAAA;QACD,IAAA,WAAA;AACD,gBAAK,CAAA,gBAAA,gBAAA,EACN,UAAgB,kKACjB,CAAA,EAAA,gBAAoB,mBAAA;UACZ,IAAA,OAAA;AACH,kBAAS,eAAkB;;UAEhC,cAAA;UACA,CAAA,CAAA;;QAEA,CAAI;OAAE,gBAAO,iBAAA;QACb,MAAU;QACT,UAAa;QACd,MAAA;QACF,CAAA;OAAA;;KAEN,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,SAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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.HelpFunctionDeclaration = require_components_help_builtin.HelpFunctionDeclaration;
|
|
12
|
+
exports.HelpOptionsDisplay = require_components_display.HelpOptionsDisplay;
|
|
13
|
+
exports.HelpUsageDisplay = require_components_display.HelpUsageDisplay;
|
|
14
|
+
exports.VirtualCommandHelpDisplay = require_components_display.VirtualCommandHelpDisplay;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BaseHelpDisplay, BaseHelpDisplayProps, CommandHelpDisplay, CommandHelpDisplayProps, HelpCommandsDisplay, HelpCommandsDisplayProps, HelpOptionsDisplay, HelpOptionsDisplayProps, HelpUsageDisplay, HelpUsageDisplayProps, VirtualCommandHelpDisplay, VirtualCommandHelpDisplayProps } from "./display.cjs";
|
|
2
|
+
import { HelpBuiltin, HelpBuiltinProps, HelpFunctionDeclaration } from "./help-builtin.cjs";
|
|
3
|
+
import { HelpCommand } from "./help-command.cjs";
|
|
4
|
+
export { BaseHelpDisplay, BaseHelpDisplayProps, CommandHelpDisplay, CommandHelpDisplayProps, HelpBuiltin, HelpBuiltinProps, HelpCommand, HelpCommandsDisplay, HelpCommandsDisplayProps, HelpFunctionDeclaration, HelpOptionsDisplay, HelpOptionsDisplayProps, HelpUsageDisplay, HelpUsageDisplayProps, VirtualCommandHelpDisplay, VirtualCommandHelpDisplayProps };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BaseHelpDisplay, BaseHelpDisplayProps, CommandHelpDisplay, CommandHelpDisplayProps, HelpCommandsDisplay, HelpCommandsDisplayProps, HelpOptionsDisplay, HelpOptionsDisplayProps, HelpUsageDisplay, HelpUsageDisplayProps, VirtualCommandHelpDisplay, VirtualCommandHelpDisplayProps } from "./display.mjs";
|
|
2
|
+
import { HelpBuiltin, HelpBuiltinProps, HelpFunctionDeclaration } from "./help-builtin.mjs";
|
|
3
|
+
import { HelpCommand } from "./help-command.mjs";
|
|
4
|
+
export { BaseHelpDisplay, BaseHelpDisplayProps, CommandHelpDisplay, CommandHelpDisplayProps, HelpBuiltin, HelpBuiltinProps, HelpCommand, HelpCommandsDisplay, HelpCommandsDisplayProps, HelpFunctionDeclaration, HelpOptionsDisplay, HelpOptionsDisplayProps, HelpUsageDisplay, HelpUsageDisplayProps, VirtualCommandHelpDisplay, VirtualCommandHelpDisplayProps };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BaseHelpDisplay, CommandHelpDisplay, HelpCommandsDisplay, HelpOptionsDisplay, HelpUsageDisplay, VirtualCommandHelpDisplay } from "./display.mjs";
|
|
2
|
+
import { HelpBuiltin, HelpFunctionDeclaration } from "./help-builtin.mjs";
|
|
3
|
+
import { HelpCommand } from "./help-command.mjs";
|
|
4
|
+
|
|
5
|
+
export { BaseHelpDisplay, CommandHelpDisplay, HelpBuiltin, HelpCommand, HelpCommandsDisplay, HelpFunctionDeclaration, HelpOptionsDisplay, HelpUsageDisplay, VirtualCommandHelpDisplay };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_is_set_string = require('./node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.cjs');
|
|
4
|
+
const require_components_help_builtin = require('./components/help-builtin.cjs');
|
|
5
|
+
const require_components_help_command = require('./components/help-command.cjs');
|
|
6
|
+
require('./components/index.cjs');
|
|
7
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
8
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
9
|
+
let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
|
|
10
|
+
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
11
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
12
|
+
let _shell_shock_plugin_console = require("@shell-shock/plugin-console");
|
|
13
|
+
_shell_shock_plugin_console = require_runtime.__toESM(_shell_shock_plugin_console);
|
|
14
|
+
let _shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
|
|
15
|
+
_shell_shock_plugin_theme = require_runtime.__toESM(_shell_shock_plugin_theme);
|
|
16
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
17
|
+
let defu = require("defu");
|
|
18
|
+
defu = require_runtime.__toESM(defu);
|
|
19
|
+
|
|
20
|
+
//#region src/index.tsx
|
|
21
|
+
/**
|
|
22
|
+
* The Help - Shell Shock plugin to add a help command to the application.
|
|
23
|
+
*/
|
|
24
|
+
const plugin = (options = {}) => {
|
|
25
|
+
return [
|
|
26
|
+
...(0, _shell_shock_plugin_theme.default)(options.theme),
|
|
27
|
+
(0, _shell_shock_plugin_console.default)(options.console),
|
|
28
|
+
{
|
|
29
|
+
name: "shell-shock:help",
|
|
30
|
+
enforce: "post",
|
|
31
|
+
config() {
|
|
32
|
+
this.debug("Providing default configuration for the Shell Shock `help` plugin.");
|
|
33
|
+
return { help: (0, defu.default)({ command: options.command === false ? false : require_is_set_string.isSetString(options.command) ? options.command : "help" }, options, { builtins: true }) };
|
|
34
|
+
},
|
|
35
|
+
async configResolved() {
|
|
36
|
+
this.debug("Adding the Help command to the application context.");
|
|
37
|
+
if (this.config.help.command !== false) {
|
|
38
|
+
this.inputs ??= [];
|
|
39
|
+
if (this.inputs.some((input) => input.name === this.config.help.command)) 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.");
|
|
40
|
+
else this.inputs.push({
|
|
41
|
+
id: this.config.help.command,
|
|
42
|
+
name: this.config.help.command,
|
|
43
|
+
path: this.config.help.command,
|
|
44
|
+
segments: [this.config.help.command],
|
|
45
|
+
title: "Help",
|
|
46
|
+
description: `A command for displaying help information to assist in using the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(this, true)} command-line interface application.`,
|
|
47
|
+
entry: {
|
|
48
|
+
file: (0, _stryke_path_join.joinPaths)(this.entryPath, "help", "index.ts"),
|
|
49
|
+
input: { file: (0, _stryke_path_join.joinPaths)(this.entryPath, "help", "command.ts") }
|
|
50
|
+
},
|
|
51
|
+
isVirtual: false
|
|
52
|
+
});
|
|
53
|
+
await (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_command.HelpCommand, {}));
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
prepare: {
|
|
57
|
+
order: "post",
|
|
58
|
+
async handler() {
|
|
59
|
+
const _self$ = this;
|
|
60
|
+
const commands = await (0, _shell_shock_core_plugin_utils.getCommandList)(this);
|
|
61
|
+
this.debug(`Rendering \`help\` built-ins for each of the ${commands.length} command modules.`);
|
|
62
|
+
const bin = (0, _alloy_js_core.computed)(() => ({
|
|
63
|
+
id: "",
|
|
64
|
+
name: (0, _shell_shock_core_plugin_utils.getAppName)(this),
|
|
65
|
+
title: (0, _shell_shock_core_plugin_utils.getAppTitle)(this),
|
|
66
|
+
description: (0, _shell_shock_core_plugin_utils.getAppDescription)(this),
|
|
67
|
+
isVirtual: true,
|
|
68
|
+
path: null,
|
|
69
|
+
segments: [],
|
|
70
|
+
alias: [],
|
|
71
|
+
options: Object.fromEntries(this.options.map((option) => [option.name, option])),
|
|
72
|
+
entry: { file: (0, _stryke_path_join.joinPaths)(this.entryPath, "bin.ts") },
|
|
73
|
+
args: [],
|
|
74
|
+
parent: null,
|
|
75
|
+
children: this.commands
|
|
76
|
+
}));
|
|
77
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
78
|
+
get when() {
|
|
79
|
+
return _self$.config.help.builtins !== false;
|
|
80
|
+
},
|
|
81
|
+
get children() {
|
|
82
|
+
return [
|
|
83
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_builtin.HelpBuiltin, { get command() {
|
|
84
|
+
return bin.value;
|
|
85
|
+
} }),
|
|
86
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
87
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
88
|
+
get each() {
|
|
89
|
+
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
90
|
+
},
|
|
91
|
+
doubleHardline: true,
|
|
92
|
+
children: (command) => (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_builtin.HelpBuiltin, { command })
|
|
93
|
+
})
|
|
94
|
+
];
|
|
95
|
+
}
|
|
96
|
+
})]);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
];
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
exports.default = plugin;
|
|
105
|
+
exports.plugin = plugin;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HelpPluginContext, HelpPluginOptions, HelpPluginResolvedConfig, HelpPluginUserConfig } from "./types/plugin.cjs";
|
|
2
|
+
import { Plugin } from "powerlines";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The Help - Shell Shock plugin to add a help command to the application.
|
|
7
|
+
*/
|
|
8
|
+
declare const plugin: <TContext extends HelpPluginContext = HelpPluginContext>(options?: HelpPluginOptions) => Plugin<TContext>[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { HelpPluginContext, HelpPluginOptions, HelpPluginResolvedConfig, HelpPluginUserConfig, plugin as default, plugin };
|
|
11
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;AAyCA;;cAAa,MAAA,oBAA2B,iBAAA,GAAoB,iBAAA,EAC1D,OAAA,GAAS,iBAAA,KAgHJ,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HelpPluginContext, HelpPluginOptions, HelpPluginResolvedConfig, HelpPluginUserConfig } from "./types/plugin.mjs";
|
|
2
|
+
import { Plugin } from "powerlines";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The Help - Shell Shock plugin to add a help command to the application.
|
|
7
|
+
*/
|
|
8
|
+
declare const plugin: <TContext extends HelpPluginContext = HelpPluginContext>(options?: HelpPluginOptions) => Plugin<TContext>[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { HelpPluginContext, HelpPluginOptions, HelpPluginResolvedConfig, HelpPluginUserConfig, plugin as default, plugin };
|
|
11
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAyCA;cAAa,MAAA,oBAA2B,iBAAA,GAAoB,iBAAA,EAC1D,OAAA,GAAS,iBAAA,KAgHJ,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { isSetString } from "./node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs";
|
|
2
|
+
import { HelpBuiltin } from "./components/help-builtin.mjs";
|
|
3
|
+
import { HelpCommand } from "./components/help-command.mjs";
|
|
4
|
+
import "./components/index.mjs";
|
|
5
|
+
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
6
|
+
import { For, Show, computed } from "@alloy-js/core";
|
|
7
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components";
|
|
8
|
+
import { render } from "@powerlines/plugin-alloy/render";
|
|
9
|
+
import { getAppDescription, getAppName, getAppTitle, getCommandList } from "@shell-shock/core/plugin-utils";
|
|
10
|
+
import console from "@shell-shock/plugin-console";
|
|
11
|
+
import theme from "@shell-shock/plugin-theme";
|
|
12
|
+
import { joinPaths } from "@stryke/path/join";
|
|
13
|
+
import defu from "defu";
|
|
14
|
+
|
|
15
|
+
//#region src/index.tsx
|
|
16
|
+
/**
|
|
17
|
+
* The Help - Shell Shock plugin to add a help command to the application.
|
|
18
|
+
*/
|
|
19
|
+
const plugin = (options = {}) => {
|
|
20
|
+
return [
|
|
21
|
+
...theme(options.theme),
|
|
22
|
+
console(options.console),
|
|
23
|
+
{
|
|
24
|
+
name: "shell-shock:help",
|
|
25
|
+
enforce: "post",
|
|
26
|
+
config() {
|
|
27
|
+
this.debug("Providing default configuration for the Shell Shock `help` plugin.");
|
|
28
|
+
return { help: defu({ command: options.command === false ? false : isSetString(options.command) ? options.command : "help" }, options, { builtins: true }) };
|
|
29
|
+
},
|
|
30
|
+
async configResolved() {
|
|
31
|
+
this.debug("Adding the Help command to the application context.");
|
|
32
|
+
if (this.config.help.command !== false) {
|
|
33
|
+
this.inputs ??= [];
|
|
34
|
+
if (this.inputs.some((input) => input.name === this.config.help.command)) 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.");
|
|
35
|
+
else this.inputs.push({
|
|
36
|
+
id: this.config.help.command,
|
|
37
|
+
name: this.config.help.command,
|
|
38
|
+
path: this.config.help.command,
|
|
39
|
+
segments: [this.config.help.command],
|
|
40
|
+
title: "Help",
|
|
41
|
+
description: `A command for displaying help information to assist in using the ${getAppTitle(this, true)} command-line interface application.`,
|
|
42
|
+
entry: {
|
|
43
|
+
file: joinPaths(this.entryPath, "help", "index.ts"),
|
|
44
|
+
input: { file: joinPaths(this.entryPath, "help", "command.ts") }
|
|
45
|
+
},
|
|
46
|
+
isVirtual: false
|
|
47
|
+
});
|
|
48
|
+
await render(this, createComponent(HelpCommand, {}));
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
prepare: {
|
|
52
|
+
order: "post",
|
|
53
|
+
async handler() {
|
|
54
|
+
const _self$ = this;
|
|
55
|
+
const commands = await getCommandList(this);
|
|
56
|
+
this.debug(`Rendering \`help\` built-ins for each of the ${commands.length} command modules.`);
|
|
57
|
+
const bin = computed(() => ({
|
|
58
|
+
id: "",
|
|
59
|
+
name: getAppName(this),
|
|
60
|
+
title: getAppTitle(this),
|
|
61
|
+
description: getAppDescription(this),
|
|
62
|
+
isVirtual: true,
|
|
63
|
+
path: null,
|
|
64
|
+
segments: [],
|
|
65
|
+
alias: [],
|
|
66
|
+
options: Object.fromEntries(this.options.map((option) => [option.name, option])),
|
|
67
|
+
entry: { file: joinPaths(this.entryPath, "bin.ts") },
|
|
68
|
+
args: [],
|
|
69
|
+
parent: null,
|
|
70
|
+
children: this.commands
|
|
71
|
+
}));
|
|
72
|
+
return render(this, [createComponent(Show, {
|
|
73
|
+
get when() {
|
|
74
|
+
return _self$.config.help.builtins !== false;
|
|
75
|
+
},
|
|
76
|
+
get children() {
|
|
77
|
+
return [
|
|
78
|
+
createComponent(HelpBuiltin, { get command() {
|
|
79
|
+
return bin.value;
|
|
80
|
+
} }),
|
|
81
|
+
createComponent(Spacing, {}),
|
|
82
|
+
createComponent(For, {
|
|
83
|
+
get each() {
|
|
84
|
+
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
85
|
+
},
|
|
86
|
+
doubleHardline: true,
|
|
87
|
+
children: (command) => createComponent(HelpBuiltin, { command })
|
|
88
|
+
})
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
})]);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
];
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
export { plugin as default, plugin };
|
|
100
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +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 getAppDescription,\n getAppName,\n getAppTitle,\n getCommandList\n} from \"@shell-shock/core/plugin-utils\";\nimport console from \"@shell-shock/plugin-console\";\nimport theme from \"@shell-shock/plugin-theme\";\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 } 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) => {\n return [\n ...theme(options.theme),\n console(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 ? options.command\n : \"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(input => input.name === this.config.help.command)\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,\n name: this.config.help.command,\n path: this.config.help.command,\n segments: [this.config.help.command],\n title: \"Help\",\n description: `A command for displaying help information to assist in using the ${getAppTitle(\n this,\n true\n )} command-line interface application.`,\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 });\n }\n\n await render(this, <HelpCommand />);\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 bin = computed(() => ({\n id: \"\",\n name: getAppName(this),\n title: getAppTitle(this),\n description: getAppDescription(this),\n isVirtual: true,\n path: null,\n segments: [],\n alias: [],\n options: Object.fromEntries(\n this.options.map(option => [option.name, option])\n ),\n entry: {\n file: joinPaths(this.entryPath, \"bin.ts\")\n },\n args: [],\n parent: null,\n children: this.commands\n }));\n\n return render(\n this,\n <>\n <Show when={this.config.help.builtins !== false}>\n <HelpBuiltin command={bin.value} />\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 </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoCA,MAAa,UAAe,UAAA,EAAA,KAAA;;;;;GAE1B,MAAA;GACC,SAAU;GACX,SAAA;AACI,SAAC,MAAM,qEAAiE;AAC5E,WAAS,EACN,MAAA,KAAA,EACI,SAAA,QAAA,YAAA,QAAA,QAAA,YAAA,QAAA,QAAA,GAAA,QAAA,UAAA,QACF,EAAA,SAAa,EAChB,UAAgB,MAChB,CAAA,EACE;;GAEF,MAAE,iBAAS;AACT,SAAE,MAAK,sDAAK;AACZ,QAAI,KAAC,OAAU,KAAA,YAAQ,OAAiB;AACtC,UAAC,WAAA,EAAA;8EAED,MAAO,KAAA,2LAAA;SAEL,MAAE,OAAA,KAAA;MACA,IAAE,KAAO,OAAA,KAAA;MACT,MAAI,KAAO,OAAC,KAAW;MACvB,MAAM,KAAE,OAAA,KAAA;MACR,UAAQ,CAAA,KAAA,OAAY,KAAQ,QAAO;MACnC,OAAO;MACP,aAAW,oEAAI,YAAA,MAAA,KAAA,CAAA;MACf,OAAC;OACD,MAAO,UAAA,KAAA,WAAA,QAAA,WAAA;OACP,OAAA,EACE,MAAQ,UAAE,KAAA,WAAA,QAAA,aAAA,EACZ;OACF;MACD,WAAA;MACF,CAAA;AAEC,WAAK,OAAO,MAAO,gBAAiB,aAAO,EAAA,CAAA,CAAW;;;GAG1D,SAAM;IACJ,OAAO;IACP,MAAM,UAAK;KACT,MAAI,SAAA;KACJ,MAAI,WAAS,MAAA,eAAA,KAAA;AACb,UAAK,MAAM,gDAA8C,SAAS,OAAS,mBAAe;KAC1F,MAAK,MAAA,gBAAA;MACH,IAAE;MACF,MAAM,WAAQ,KAAK;MACnB,OAAO,YAAY,KAAK;MACxB,aAAU,kBAAiB,KAAO;MAClC,WAAU;MACV,MAAI;MACJ,UAAU,EAAE;MACZ,OAAI,EAAA;MACJ,SAAM,OAAI,YAAA,KAAA,QAAA,KAAA,WAAA,CAAA,OAAA,MAAA,OAAA,CAAA,CAAA;MACV,OAAM,EACJ,MAAK,UAAQ,KAAK,WAAU,SAAa,EAC1C;MACD,MAAM,EAAA;MACN,QAAM;MACN,UAAQ,KAAM;MACf,EAAE;AACH,YAAO,OAAA,MAAA,CAAA,gBAAA,MAAA;MACL,IAAI,OAAA;AACF,cAAE,OAAA,OAAA,KAAA,aAAA;;;AAGJ,cAAM;QAAA,gBAAc,aAAe,EACrC,IAAA,UAAA;AACD,gBAAA,IAAA;WAEM,CAAC;QAAE,gBAAK,SAAA,EAAA,CAAA;QAAA,gBAAA,KAAA;SACP,IAAA,OAAU;AACR,iBAAA,SAAgB,MAAC,GAAA,MAAc,EAAC,KAAK,cAAA,EAAA,KAAA,CAAA;;SAExC,gBAAiB;SAChB,WAAS,YAAA,gBAAA,aAAA,EACD,SACX,CAAA;;;;MAGF,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../../node_modules/.pnpm/@stryke+string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Check if the input string is in constant case.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Constant case is defined as all uppercase letters with underscores separating words - "THIS_IS_AN_EXAMPLE".
|
|
8
|
+
*
|
|
9
|
+
* @param input - The input string to check.
|
|
10
|
+
* @returns True if the input is in constant case, false otherwise.
|
|
11
|
+
*/
|
|
12
|
+
function isConstantCase(input) {
|
|
13
|
+
return input ? /^[A-Z0-9_]+$/.test(input) : false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.isConstantCase = isConstantCase;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@stryke+string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Check if the input string is in constant case.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Constant case is defined as all uppercase letters with underscores separating words - "THIS_IS_AN_EXAMPLE".
|
|
7
|
+
*
|
|
8
|
+
* @param input - The input string to check.
|
|
9
|
+
* @returns True if the input is in constant case, false otherwise.
|
|
10
|
+
*/
|
|
11
|
+
function isConstantCase(input) {
|
|
12
|
+
return input ? /^[A-Z0-9_]+$/.test(input) : false;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { isConstantCase };
|
|
17
|
+
//# sourceMappingURL=constant-case.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant-case.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs"],"sourcesContent":["import { getWords } from \"./get-words.mjs\";\nimport { isSnakeCase } from \"./snake-case.mjs\";\n\n//#region src/constant-case.ts\n/**\n* Check if the input string is in constant case.\n*\n* @remarks\n* Constant case is defined as all uppercase letters with underscores separating words - \"THIS_IS_AN_EXAMPLE\".\n*\n* @param input - The input string to check.\n* @returns True if the input is in constant case, false otherwise.\n*/\nfunction isConstantCase(input) {\n\treturn input ? /^[A-Z0-9_]+$/.test(input) : false;\n}\n/**\n* Convert the input string to constant case.\n*\n* @remarks\n* Constant case is defined as all uppercase letters with underscores separating words - \"THIS_IS_AN_EXAMPLE\".\n*\n* @param input - The input string.\n* @returns The constant-cased string.\n*/\nfunction constantCase(input) {\n\treturn isConstantCase(input) || input === void 0 ? input : isSnakeCase(input) ? input.toUpperCase() : getWords(input).join(\"_\").toUpperCase();\n}\n\n//#endregion\nexport { constantCase, isConstantCase };\n//# sourceMappingURL=constant-case.mjs.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;AAaA,SAAS,eAAe,OAAO;AAC9B,QAAO,QAAQ,eAAe,KAAK,MAAM,GAAG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../../node_modules/.pnpm/@stryke+string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Regular expression pattern to split strings into words for various case conversions
|
|
5
|
+
*
|
|
6
|
+
* This pattern matches sequences of characters in a string, considering the following case:
|
|
7
|
+
* - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)
|
|
8
|
+
* - Sequences of one uppercase letter optionally followed by lowercase letters and digits
|
|
9
|
+
* - Single uppercase letters
|
|
10
|
+
* - Sequences of digits
|
|
11
|
+
*
|
|
12
|
+
* The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into
|
|
13
|
+
* a consistent format like snake case.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);
|
|
17
|
+
* // matches: ['camel', 'Case', 'HTTP', 'Request']
|
|
18
|
+
*/
|
|
19
|
+
const CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|\d+|[A-Z]+(?![a-z])/g;
|
|
20
|
+
const RELAXED_SPLIT_PATTERN = /[A-Z/.-]?[a-z/.-]+|\d+|[A-Z/.-]+(?![a-z/.-])/g;
|
|
21
|
+
/**
|
|
22
|
+
* Splits a string into words using a regular expression pattern
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const words = getWords('camelCaseHTTPRequest');
|
|
26
|
+
* // words: ['camel', 'Case', 'HTTP', 'Request']
|
|
27
|
+
*
|
|
28
|
+
* @param str - The string to split into words
|
|
29
|
+
* @param options - Options for splitting the string
|
|
30
|
+
* @returns An array of words
|
|
31
|
+
*/
|
|
32
|
+
function getWords(str, options = {}) {
|
|
33
|
+
if (str.length > 5e3) throw new Error("The regular expression parameter of `get-words` can't handle strings longer than 2000 characters");
|
|
34
|
+
return [...str.match(options.split ?? (options.relaxed ? RELAXED_SPLIT_PATTERN : CASE_SPLIT_PATTERN)) ?? []];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
exports.getWords = getWords;
|