@shell-shock/preset-cli 0.7.13 → 0.8.3
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 → _rolldown/runtime.cjs} +1 -1
- package/dist/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/components/banner-function-declaration.cjs +48 -164
- package/dist/components/banner-function-declaration.d.cts +2 -2
- package/dist/components/banner-function-declaration.d.cts.map +1 -1
- package/dist/components/banner-function-declaration.d.mts +2 -2
- package/dist/components/banner-function-declaration.d.mts.map +1 -1
- package/dist/components/banner-function-declaration.mjs +29 -146
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/command-entry.cjs +185 -144
- package/dist/components/command-entry.d.cts +2 -2
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +3 -3
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +124 -84
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +20 -18
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/command-router.d.mts.map +1 -1
- package/dist/components/command-router.mjs +2 -1
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/index.cjs +4 -0
- package/dist/components/index.d.cts +2 -1
- package/dist/components/index.d.mts +2 -1
- package/dist/components/index.mjs +2 -1
- package/dist/components/upgrade-builtin.cjs +171 -0
- package/dist/components/upgrade-builtin.d.cts +15 -0
- package/dist/components/upgrade-builtin.d.cts.map +1 -0
- package/dist/components/upgrade-builtin.d.mts +15 -0
- package/dist/components/upgrade-builtin.d.mts.map +1 -0
- package/dist/components/upgrade-builtin.mjs +169 -0
- package/dist/components/upgrade-builtin.mjs.map +1 -0
- package/dist/components/virtual-command-entry.cjs +26 -24
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts +1 -1
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +7 -6
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +6 -6
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +49 -62
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +23 -36
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-help/dist/components/display.cjs +259 -0
- package/dist/plugin-help/dist/components/display.mjs +254 -0
- package/dist/plugin-help/dist/components/display.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-builtin.cjs +85 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs +84 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-command.cjs +96 -0
- package/dist/plugin-help/dist/components/help-command.mjs +96 -0
- package/dist/plugin-help/dist/components/help-command.mjs.map +1 -0
- package/dist/plugin-help/dist/components/index.cjs +3 -0
- package/dist/plugin-help/dist/components/index.mjs +5 -0
- package/dist/plugin-help/dist/index.cjs +103 -0
- package/dist/plugin-help/dist/index.d.cts +2 -0
- package/dist/plugin-help/dist/index.d.mts +2 -0
- package/dist/plugin-help/dist/index.mjs +100 -0
- package/dist/plugin-help/dist/index.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.cjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.cjs +38 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs +38 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs +33 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs +34 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs +40 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs +41 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.cjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs +17 -0
- package/dist/plugin-help/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/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.cjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.cjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.cjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs +21 -0
- package/dist/plugin-help/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/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.cjs +19 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.cjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.cjs +8 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs +8 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.cts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.cts.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.mts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/plugin.d.cts +20 -34
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +20 -34
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +30 -16
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { CommandHelpDisplay, VirtualCommandHelpDisplay } from "./display.mjs";
|
|
2
|
+
import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { Show, code, splitProps } from "@alloy-js/core";
|
|
4
|
+
import { FunctionDeclaration, IfStatement } from "@alloy-js/typescript";
|
|
5
|
+
import { getAppTitle, isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
6
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
7
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
8
|
+
import defu from "defu";
|
|
9
|
+
import "@powerlines/plugin-alloy/typescript";
|
|
10
|
+
import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
11
|
+
import { joinPaths } from "@stryke/path";
|
|
12
|
+
|
|
13
|
+
//#region ../plugin-help/dist/components/help-builtin.mjs
|
|
14
|
+
/**
|
|
15
|
+
* A built-in help module for Shell Shock.
|
|
16
|
+
*/
|
|
17
|
+
function HelpBuiltin(props) {
|
|
18
|
+
const [{ command, children }, rest] = splitProps(props, ["command", "children"]);
|
|
19
|
+
const context = usePowerlines();
|
|
20
|
+
return createComponent(BuiltinFile, mergeProps({
|
|
21
|
+
get id() {
|
|
22
|
+
return joinPaths("help", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)));
|
|
23
|
+
},
|
|
24
|
+
get description() {
|
|
25
|
+
return memo(() => !!command.path)() ? `A collection of utility functions that assist in displaying help information for the ${command.title} command.` : `A collection of utility functions that assist in displaying help information for the ${getAppTitle(context, true)} command-line interface application.`;
|
|
26
|
+
}
|
|
27
|
+
}, rest, {
|
|
28
|
+
get builtinImports() {
|
|
29
|
+
return defu(rest.builtinImports ?? {}, {
|
|
30
|
+
utils: ["isUnicodeSupported"],
|
|
31
|
+
console: [
|
|
32
|
+
"splitText",
|
|
33
|
+
"writeLine",
|
|
34
|
+
"colors",
|
|
35
|
+
"help",
|
|
36
|
+
"table"
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
get children() {
|
|
41
|
+
return [
|
|
42
|
+
createComponent(FunctionDeclaration, {
|
|
43
|
+
"export": true,
|
|
44
|
+
name: "showHelp",
|
|
45
|
+
get doc() {
|
|
46
|
+
return `Display help information for the ${command.path ? `${command.title} command` : `${getAppTitle(context, true)} application`}.`;
|
|
47
|
+
},
|
|
48
|
+
parameters: [],
|
|
49
|
+
get children() {
|
|
50
|
+
return createComponent(Show, {
|
|
51
|
+
get when() {
|
|
52
|
+
return !command.isVirtual;
|
|
53
|
+
},
|
|
54
|
+
get fallback() {
|
|
55
|
+
return createComponent(VirtualCommandHelpDisplay, {
|
|
56
|
+
get options() {
|
|
57
|
+
return Object.values(command.options);
|
|
58
|
+
},
|
|
59
|
+
get commands() {
|
|
60
|
+
return command.children ?? {};
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
get children() {
|
|
65
|
+
return createComponent(CommandHelpDisplay, { command });
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
createComponent(Spacing, {}),
|
|
71
|
+
createComponent(Show, {
|
|
72
|
+
get when() {
|
|
73
|
+
return Boolean(children);
|
|
74
|
+
},
|
|
75
|
+
children
|
|
76
|
+
})
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
export { HelpBuiltin };
|
|
84
|
+
//# sourceMappingURL=help-builtin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-builtin.mjs","names":[],"sources":["../../../../../plugin-help/dist/components/help-builtin.mjs"],"sourcesContent":["import { CommandHelpDisplay, VirtualCommandHelpDisplay } from \"./display.mjs\";\nimport { createComponent, memo, mergeProps } from \"@alloy-js/core/jsx-runtime\";\nimport { Show, code, splitProps } from \"@alloy-js/core\";\nimport { getAppTitle, isDynamicPathSegment } from \"@shell-shock/core/plugin-utils\";\nimport defu from \"defu\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { TSDoc, TSDocRemarks, TSDocReturns } from \"@powerlines/plugin-alloy/typescript\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { joinPaths } from \"@stryke/path\";\n\n//#region src/components/help-builtin.tsx\n/**\n* The `updateVersionCheckFile` handler function declaration code for the Shell Shock project.\n*/\nfunction HelpFunctionDeclaration() {\n\treturn [createComponent(TSDoc, {\n\t\theading: \"A helper function that updates the version check file.\",\n\t\tget children() {\n\t\t\treturn [\n\t\t\t\tcreateComponent(TSDocRemarks, { children: `This function is used to update the version check file with the current timestamp. It can be used in the CLI upgrade command to record the last time a check for updates was performed. The function writes a \"version-check.json\" file in the data directory, which contains a timestamp of the last check for updates.` }),\n\t\t\t\tcreateComponent(Spacing, {}),\n\t\t\t\tcreateComponent(TSDocReturns, { children: `A promise that resolves to a boolean indicating whether a check for updates is required.` })\n\t\t\t];\n\t\t}\n\t}), createComponent(FunctionDeclaration, {\n\t\t\"export\": true,\n\t\tasync: true,\n\t\tname: \"updateVersionCheckFile\",\n\t\treturnType: \"void\",\n\t\tget children() {\n\t\t\treturn [createComponent(IfStatement, {\n\t\t\t\tcondition: code`!existsSync(paths.data)`,\n\t\t\t\tchildren: code`await mkdir(paths.data, { recursive: true }); `\n\t\t\t}), code`await writeFile(join(paths.data, \"version-check.json\"), JSON.stringify({ timestamp: new Date().getTime() }), \"utf8\"); `];\n\t\t}\n\t})];\n}\n/**\n* A built-in help module for Shell Shock.\n*/\nfunction HelpBuiltin(props) {\n\tconst [{ command, children }, rest] = splitProps(props, [\"command\", \"children\"]);\n\tconst context = usePowerlines();\n\treturn createComponent(BuiltinFile, mergeProps({\n\t\tget id() {\n\t\t\treturn joinPaths(\"help\", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)));\n\t\t},\n\t\tget description() {\n\t\t\treturn memo(() => !!command.path)() ? `A collection of utility functions that assist in displaying help information for the ${command.title} command.` : `A collection of utility functions that assist in displaying help information for the ${getAppTitle(context, true)} command-line interface application.`;\n\t\t}\n\t}, rest, {\n\t\tget builtinImports() {\n\t\t\treturn defu(rest.builtinImports ?? {}, {\n\t\t\t\tutils: [\"isUnicodeSupported\"],\n\t\t\t\tconsole: [\n\t\t\t\t\t\"splitText\",\n\t\t\t\t\t\"writeLine\",\n\t\t\t\t\t\"colors\",\n\t\t\t\t\t\"help\",\n\t\t\t\t\t\"table\"\n\t\t\t\t]\n\t\t\t});\n\t\t},\n\t\tget children() {\n\t\t\treturn [\n\t\t\t\tcreateComponent(FunctionDeclaration, {\n\t\t\t\t\t\"export\": true,\n\t\t\t\t\tname: \"showHelp\",\n\t\t\t\t\tget doc() {\n\t\t\t\t\t\treturn `Display help information for the ${command.path ? `${command.title} command` : `${getAppTitle(context, true)} application`}.`;\n\t\t\t\t\t},\n\t\t\t\t\tparameters: [],\n\t\t\t\t\tget children() {\n\t\t\t\t\t\treturn createComponent(Show, {\n\t\t\t\t\t\t\tget when() {\n\t\t\t\t\t\t\t\treturn !command.isVirtual;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tget fallback() {\n\t\t\t\t\t\t\t\treturn createComponent(VirtualCommandHelpDisplay, {\n\t\t\t\t\t\t\t\t\tget options() {\n\t\t\t\t\t\t\t\t\t\treturn Object.values(command.options);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tget commands() {\n\t\t\t\t\t\t\t\t\t\treturn command.children ?? {};\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tget children() {\n\t\t\t\t\t\t\t\treturn createComponent(CommandHelpDisplay, { command });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tcreateComponent(Spacing, {}),\n\t\t\t\tcreateComponent(Show, {\n\t\t\t\t\tget when() {\n\t\t\t\t\t\treturn Boolean(children);\n\t\t\t\t\t},\n\t\t\t\t\tchildren\n\t\t\t\t})\n\t\t\t];\n\t\t}\n\t}));\n}\n\n//#endregion\nexport { HelpBuiltin, HelpFunctionDeclaration };\n//# sourceMappingURL=help-builtin.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AA0CA,SAAS,YAAY,OAAO;CAC3B,MAAM,CAAC,EAAE,SAAS,YAAY,QAAQ,WAAW,OAAO,CAAC,WAAW,WAAW,CAAC;CAChF,MAAM,UAAU,eAAe;AAC/B,QAAO,gBAAgB,aAAa,WAAW;EAC9C,IAAI,KAAK;AACR,UAAO,UAAU,QAAQ,GAAG,QAAQ,SAAS,QAAQ,YAAY,CAAC,qBAAqB,QAAQ,CAAC,CAAC;;EAElG,IAAI,cAAc;AACjB,UAAO,WAAW,CAAC,CAAC,QAAQ,KAAK,EAAE,GAAG,wFAAwF,QAAQ,MAAM,aAAa,wFAAwF,YAAY,SAAS,KAAK,CAAC;;EAE7Q,EAAE,MAAM;EACR,IAAI,iBAAiB;AACpB,UAAO,KAAK,KAAK,kBAAkB,EAAE,EAAE;IACtC,OAAO,CAAC,qBAAqB;IAC7B,SAAS;KACR;KACA;KACA;KACA;KACA;KACA;IACD,CAAC;;EAEH,IAAI,WAAW;AACd,UAAO;IACN,gBAAgB,qBAAqB;KACpC,UAAU;KACV,MAAM;KACN,IAAI,MAAM;AACT,aAAO,oCAAoC,QAAQ,OAAO,GAAG,QAAQ,MAAM,YAAY,GAAG,YAAY,SAAS,KAAK,CAAC,cAAc;;KAEpI,YAAY,EAAE;KACd,IAAI,WAAW;AACd,aAAO,gBAAgB,MAAM;OAC5B,IAAI,OAAO;AACV,eAAO,CAAC,QAAQ;;OAEjB,IAAI,WAAW;AACd,eAAO,gBAAgB,2BAA2B;SACjD,IAAI,UAAU;AACb,iBAAO,OAAO,OAAO,QAAQ,QAAQ;;SAEtC,IAAI,WAAW;AACd,iBAAO,QAAQ,YAAY,EAAE;;SAE9B,CAAC;;OAEH,IAAI,WAAW;AACd,eAAO,gBAAgB,oBAAoB,EAAE,SAAS,CAAC;;OAExD,CAAC;;KAEH,CAAC;IACF,gBAAgB,SAAS,EAAE,CAAC;IAC5B,gBAAgB,MAAM;KACrB,IAAI,OAAO;AACV,aAAO,QAAQ,SAAS;;KAEzB;KACA,CAAC;IACF;;EAEF,CAAC,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
4
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
5
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
6
|
+
let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
|
|
7
|
+
let _stryke_path = require("@stryke/path");
|
|
8
|
+
let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
9
|
+
let _powerlines_plugin_alloy_core = require("@powerlines/plugin-alloy/core");
|
|
10
|
+
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
11
|
+
|
|
12
|
+
//#region ../plugin-help/dist/components/help-command.mjs
|
|
13
|
+
/**
|
|
14
|
+
* The Help command's handler wrapper for the Shell Shock project.
|
|
15
|
+
*/
|
|
16
|
+
function HelpCommand() {
|
|
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
|
+
imports: {
|
|
23
|
+
"node:os": ["os"],
|
|
24
|
+
"node:fs/promises": ["readFile", "writeFile"]
|
|
25
|
+
},
|
|
26
|
+
builtinImports: { console: [
|
|
27
|
+
"colors",
|
|
28
|
+
"writeLine",
|
|
29
|
+
"success",
|
|
30
|
+
"warn",
|
|
31
|
+
"stripAnsi"
|
|
32
|
+
] },
|
|
33
|
+
get children() {
|
|
34
|
+
return [
|
|
35
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Options for the Help command." }),
|
|
36
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
37
|
+
"export": true,
|
|
38
|
+
name: "HelpOptions",
|
|
39
|
+
get children() {
|
|
40
|
+
return [
|
|
41
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
42
|
+
heading: "Whether to help to the latest version.",
|
|
43
|
+
get children() {
|
|
44
|
+
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, {
|
|
45
|
+
get type() {
|
|
46
|
+
return _powerlines_deepkit_vendor_type.ReflectionKind.boolean;
|
|
47
|
+
},
|
|
48
|
+
defaultValue: false
|
|
49
|
+
})];
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
53
|
+
name: "latest",
|
|
54
|
+
optional: true,
|
|
55
|
+
type: "boolean"
|
|
56
|
+
}),
|
|
57
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
58
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
59
|
+
heading: "A specific application version to help to.",
|
|
60
|
+
get children() {
|
|
61
|
+
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, {
|
|
62
|
+
get type() {
|
|
63
|
+
return _powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
64
|
+
},
|
|
65
|
+
defaultValue: "latest"
|
|
66
|
+
})];
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
70
|
+
name: "version",
|
|
71
|
+
optional: true,
|
|
72
|
+
type: "string"
|
|
73
|
+
})
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
}),
|
|
77
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
78
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Handler logic for the \\`help\\` command." }),
|
|
79
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
80
|
+
"export": true,
|
|
81
|
+
"default": true,
|
|
82
|
+
async: true,
|
|
83
|
+
name: "handler",
|
|
84
|
+
parameters: [{
|
|
85
|
+
name: "options",
|
|
86
|
+
type: "HelpOptions"
|
|
87
|
+
}],
|
|
88
|
+
children: _alloy_js_core.code` return;`
|
|
89
|
+
})
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
exports.HelpCommand = HelpCommand;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { code } from "@alloy-js/core";
|
|
3
|
+
import { FunctionDeclaration, InterfaceDeclaration } from "@alloy-js/typescript";
|
|
4
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
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, TSDocDefaultValue, TSDocRemarks } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
10
|
+
|
|
11
|
+
//#region ../plugin-help/dist/components/help-command.mjs
|
|
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, { heading: "Options for the Help command." }),
|
|
35
|
+
createComponent(InterfaceDeclaration, {
|
|
36
|
+
"export": true,
|
|
37
|
+
name: "HelpOptions",
|
|
38
|
+
get children() {
|
|
39
|
+
return [
|
|
40
|
+
createComponent(TSDoc, {
|
|
41
|
+
heading: "Whether to help to the latest version.",
|
|
42
|
+
get children() {
|
|
43
|
+
return [createComponent(TSDocRemarks, { 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, {
|
|
58
|
+
heading: "A specific application version to help to.",
|
|
59
|
+
get children() {
|
|
60
|
+
return [createComponent(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.` }), 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, { 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":["TSDoc$1","TSDocRemarks$1"],"sources":["../../../../../plugin-help/dist/components/help-command.mjs"],"sourcesContent":["import { createComponent } from \"@alloy-js/core/jsx-runtime\";\nimport { code } from \"@alloy-js/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { FunctionDeclaration, InterfaceDeclaration } from \"@alloy-js/typescript\";\nimport { InterfaceMember, TypescriptFile } from \"@powerlines/plugin-alloy/typescript\";\nimport { joinPaths } from \"@stryke/path\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { TSDoc as TSDoc$1, TSDocDefaultValue, TSDocRemarks as TSDocRemarks$1 } from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\n\n//#region src/components/help-command.tsx\n/**\n* The Help command's handler wrapper for the Shell Shock project.\n*/\nfunction HelpCommand() {\n\tconst context = usePowerlines();\n\treturn createComponent(TypescriptFile, {\n\t\tget path() {\n\t\t\treturn joinPaths(context.entryPath, \"help\", \"command.ts\");\n\t\t},\n\t\timports: {\n\t\t\t\"node:os\": [\"os\"],\n\t\t\t\"node:fs/promises\": [\"readFile\", \"writeFile\"]\n\t\t},\n\t\tbuiltinImports: { console: [\n\t\t\t\"colors\",\n\t\t\t\"writeLine\",\n\t\t\t\"success\",\n\t\t\t\"warn\",\n\t\t\t\"stripAnsi\"\n\t\t] },\n\t\tget children() {\n\t\t\treturn [\n\t\t\t\tcreateComponent(TSDoc$1, { heading: \"Options for the Help command.\" }),\n\t\t\t\tcreateComponent(InterfaceDeclaration, {\n\t\t\t\t\t\"export\": true,\n\t\t\t\t\tname: \"HelpOptions\",\n\t\t\t\t\tget children() {\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tcreateComponent(TSDoc$1, {\n\t\t\t\t\t\t\t\theading: \"Whether to help to the latest version.\",\n\t\t\t\t\t\t\t\tget children() {\n\t\t\t\t\t\t\t\t\treturn [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, {\n\t\t\t\t\t\t\t\t\t\tget type() {\n\t\t\t\t\t\t\t\t\t\t\treturn ReflectionKind.boolean;\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tdefaultValue: false\n\t\t\t\t\t\t\t\t\t})];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcreateComponent(InterfaceMember, {\n\t\t\t\t\t\t\t\tname: \"latest\",\n\t\t\t\t\t\t\t\toptional: true,\n\t\t\t\t\t\t\t\ttype: \"boolean\"\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcreateComponent(Spacing, {}),\n\t\t\t\t\t\t\tcreateComponent(TSDoc$1, {\n\t\t\t\t\t\t\t\theading: \"A specific application version to help to.\",\n\t\t\t\t\t\t\t\tget children() {\n\t\t\t\t\t\t\t\t\treturn [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, {\n\t\t\t\t\t\t\t\t\t\tget type() {\n\t\t\t\t\t\t\t\t\t\t\treturn ReflectionKind.string;\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tdefaultValue: \"latest\"\n\t\t\t\t\t\t\t\t\t})];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcreateComponent(InterfaceMember, {\n\t\t\t\t\t\t\t\tname: \"version\",\n\t\t\t\t\t\t\t\toptional: true,\n\t\t\t\t\t\t\t\ttype: \"string\"\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tcreateComponent(Spacing, {}),\n\t\t\t\tcreateComponent(TSDoc$1, { heading: \"Handler logic for the \\\\`help\\\\` command.\" }),\n\t\t\t\tcreateComponent(FunctionDeclaration, {\n\t\t\t\t\t\"export\": true,\n\t\t\t\t\t\"default\": true,\n\t\t\t\t\tasync: true,\n\t\t\t\t\tname: \"handler\",\n\t\t\t\t\tparameters: [{\n\t\t\t\t\t\tname: \"options\",\n\t\t\t\t\t\ttype: \"HelpOptions\"\n\t\t\t\t\t}],\n\t\t\t\t\tchildren: code` return;`\n\t\t\t\t})\n\t\t\t];\n\t\t}\n\t});\n}\n\n//#endregion\nexport { HelpCommand };\n//# sourceMappingURL=help-command.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,cAAc;CACtB,MAAM,UAAU,eAAe;AAC/B,QAAO,gBAAgB,gBAAgB;EACtC,IAAI,OAAO;AACV,UAAO,UAAU,QAAQ,WAAW,QAAQ,aAAa;;EAE1D,SAAS;GACR,WAAW,CAAC,KAAK;GACjB,oBAAoB,CAAC,YAAY,YAAY;GAC7C;EACD,gBAAgB,EAAE,SAAS;GAC1B;GACA;GACA;GACA;GACA;GACA,EAAE;EACH,IAAI,WAAW;AACd,UAAO;IACN,gBAAgBA,OAAS,EAAE,SAAS,iCAAiC,CAAC;IACtE,gBAAgB,sBAAsB;KACrC,UAAU;KACV,MAAM;KACN,IAAI,WAAW;AACd,aAAO;OACN,gBAAgBA,OAAS;QACxB,SAAS;QACT,IAAI,WAAW;AACd,gBAAO,CAAC,gBAAgBC,cAAgB,EAAE,UAAU,yIAAyI,CAAC,EAAE,gBAAgB,mBAAmB;UAClO,IAAI,OAAO;AACV,kBAAO,eAAe;;UAEvB,cAAc;UACd,CAAC,CAAC;;QAEJ,CAAC;OACF,gBAAgB,iBAAiB;QAChC,MAAM;QACN,UAAU;QACV,MAAM;QACN,CAAC;OACF,gBAAgB,SAAS,EAAE,CAAC;OAC5B,gBAAgBD,OAAS;QACxB,SAAS;QACT,IAAI,WAAW;AACd,gBAAO,CAAC,gBAAgBC,cAAgB,EAAE,UAAU,kKAAkK,CAAC,EAAE,gBAAgB,mBAAmB;UAC3P,IAAI,OAAO;AACV,kBAAO,eAAe;;UAEvB,cAAc;UACd,CAAC,CAAC;;QAEJ,CAAC;OACF,gBAAgB,iBAAiB;QAChC,MAAM;QACN,UAAU;QACV,MAAM;QACN,CAAC;OACF;;KAEF,CAAC;IACF,gBAAgB,SAAS,EAAE,CAAC;IAC5B,gBAAgBD,OAAS,EAAE,SAAS,6CAA6C,CAAC;IAClF,gBAAgB,qBAAqB;KACpC,UAAU;KACV,WAAW;KACX,OAAO;KACP,MAAM;KACN,YAAY,CAAC;MACZ,MAAM;MACN,MAAM;MACN,CAAC;KACF,UAAU,IAAI;KACd,CAAC;IACF;;EAEF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BaseHelpDisplay, CommandHelpDisplay, HelpCommandsDisplay, HelpOptionsDisplay, HelpUsageDisplay, VirtualCommandHelpDisplay } from "./display.mjs";
|
|
2
|
+
import { HelpBuiltin } from "./help-builtin.mjs";
|
|
3
|
+
import { HelpCommand } from "./help-command.mjs";
|
|
4
|
+
|
|
5
|
+
export { };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
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');
|
|
3
|
+
const require_help_builtin = require('./components/help-builtin.cjs');
|
|
4
|
+
const require_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_plugin_console = require("@shell-shock/plugin-console");
|
|
11
|
+
_shell_shock_plugin_console = require_runtime.__toESM(_shell_shock_plugin_console);
|
|
12
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
13
|
+
let defu = require("defu");
|
|
14
|
+
defu = require_runtime.__toESM(defu);
|
|
15
|
+
let _shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
|
|
16
|
+
_shell_shock_plugin_theme = require_runtime.__toESM(_shell_shock_plugin_theme);
|
|
17
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
18
|
+
|
|
19
|
+
//#region ../plugin-help/dist/index.mjs
|
|
20
|
+
/**
|
|
21
|
+
* The Help - Shell Shock plugin to add a help command to the application.
|
|
22
|
+
*/
|
|
23
|
+
const plugin = (options = {}) => {
|
|
24
|
+
return [
|
|
25
|
+
...(0, _shell_shock_plugin_theme.default)(options.theme),
|
|
26
|
+
(0, _shell_shock_plugin_console.default)(options.console),
|
|
27
|
+
{
|
|
28
|
+
name: "shell-shock:help",
|
|
29
|
+
enforce: "post",
|
|
30
|
+
config() {
|
|
31
|
+
this.debug("Providing default configuration for the Shell Shock `help` plugin.");
|
|
32
|
+
return { help: (0, defu.default)({ command: options.command === false ? false : require_is_set_string.isSetString(options.command) ? options.command : "help" }, options, { builtins: true }) };
|
|
33
|
+
},
|
|
34
|
+
async configResolved() {
|
|
35
|
+
this.debug("Adding the Help command to the application context.");
|
|
36
|
+
if (this.config.help.command !== false) {
|
|
37
|
+
this.inputs ??= [];
|
|
38
|
+
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.");
|
|
39
|
+
else this.inputs.push({
|
|
40
|
+
id: this.config.help.command,
|
|
41
|
+
name: this.config.help.command,
|
|
42
|
+
path: this.config.help.command,
|
|
43
|
+
segments: [this.config.help.command],
|
|
44
|
+
title: "Help",
|
|
45
|
+
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.`,
|
|
46
|
+
entry: {
|
|
47
|
+
file: (0, _stryke_path_join.joinPaths)(this.entryPath, "help", "index.ts"),
|
|
48
|
+
input: { file: (0, _stryke_path_join.joinPaths)(this.entryPath, "help", "command.ts") }
|
|
49
|
+
},
|
|
50
|
+
isVirtual: false
|
|
51
|
+
});
|
|
52
|
+
await (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_help_command.HelpCommand, {}));
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
prepare: {
|
|
56
|
+
order: "post",
|
|
57
|
+
async handler() {
|
|
58
|
+
const _self$ = this;
|
|
59
|
+
const commands = await (0, _shell_shock_core_plugin_utils.getCommandList)(this);
|
|
60
|
+
this.debug(`Rendering \`help\` built-ins for each of the ${commands.length} command modules.`);
|
|
61
|
+
const bin = (0, _alloy_js_core.computed)(() => ({
|
|
62
|
+
id: "",
|
|
63
|
+
name: (0, _shell_shock_core_plugin_utils.getAppName)(this),
|
|
64
|
+
title: (0, _shell_shock_core_plugin_utils.getAppTitle)(this),
|
|
65
|
+
description: (0, _shell_shock_core_plugin_utils.getAppDescription)(this),
|
|
66
|
+
isVirtual: true,
|
|
67
|
+
path: null,
|
|
68
|
+
segments: [],
|
|
69
|
+
alias: [],
|
|
70
|
+
options: Object.fromEntries(this.options.map((option) => [option.name, option])),
|
|
71
|
+
entry: { file: (0, _stryke_path_join.joinPaths)(this.entryPath, "bin.ts") },
|
|
72
|
+
args: [],
|
|
73
|
+
parent: null,
|
|
74
|
+
children: this.commands
|
|
75
|
+
}));
|
|
76
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
77
|
+
get when() {
|
|
78
|
+
return _self$.config.help.builtins !== false;
|
|
79
|
+
},
|
|
80
|
+
get children() {
|
|
81
|
+
return [
|
|
82
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_help_builtin.HelpBuiltin, { get command() {
|
|
83
|
+
return bin.value;
|
|
84
|
+
} }),
|
|
85
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
86
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
87
|
+
get each() {
|
|
88
|
+
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
89
|
+
},
|
|
90
|
+
doubleHardline: true,
|
|
91
|
+
children: (command) => (0, _alloy_js_core_jsx_runtime.createComponent)(require_help_builtin.HelpBuiltin, { command })
|
|
92
|
+
})
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
})]);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
exports.plugin = plugin;
|
|
@@ -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 console from "@shell-shock/plugin-console";
|
|
10
|
+
import { getAppDescription, getAppName, getAppTitle, getCommandList } from "@shell-shock/core/plugin-utils";
|
|
11
|
+
import defu from "defu";
|
|
12
|
+
import theme from "@shell-shock/plugin-theme";
|
|
13
|
+
import { joinPaths } from "@stryke/path/join";
|
|
14
|
+
|
|
15
|
+
//#region ../plugin-help/dist/index.mjs
|
|
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 };
|
|
100
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../plugin-help/dist/index.mjs"],"sourcesContent":["import { isSetString } from \"./node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs\";\nimport { HelpBuiltin } from \"./components/help-builtin.mjs\";\nimport { HelpCommand } from \"./components/help-command.mjs\";\nimport \"./components/index.mjs\";\nimport { createComponent } from \"@alloy-js/core/jsx-runtime\";\nimport { For, Show, computed } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { getAppDescription, getAppName, getAppTitle, getCommandList } 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 defu from \"defu\";\n\n//#region src/index.tsx\n/**\n* The Help - Shell Shock plugin to add a help command to the application.\n*/\nconst plugin = (options = {}) => {\n\treturn [\n\t\t...theme(options.theme),\n\t\tconsole(options.console),\n\t\t{\n\t\t\tname: \"shell-shock:help\",\n\t\t\tenforce: \"post\",\n\t\t\tconfig() {\n\t\t\t\tthis.debug(\"Providing default configuration for the Shell Shock `help` plugin.\");\n\t\t\t\treturn { help: defu({ command: options.command === false ? false : isSetString(options.command) ? options.command : \"help\" }, options, { builtins: true }) };\n\t\t\t},\n\t\t\tasync configResolved() {\n\t\t\t\tthis.debug(\"Adding the Help command to the application context.\");\n\t\t\t\tif (this.config.help.command !== false) {\n\t\t\t\t\tthis.inputs ??= [];\n\t\t\t\t\tif (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.\");\n\t\t\t\t\telse this.inputs.push({\n\t\t\t\t\t\tid: this.config.help.command,\n\t\t\t\t\t\tname: this.config.help.command,\n\t\t\t\t\t\tpath: this.config.help.command,\n\t\t\t\t\t\tsegments: [this.config.help.command],\n\t\t\t\t\t\ttitle: \"Help\",\n\t\t\t\t\t\tdescription: `A command for displaying help information to assist in using the ${getAppTitle(this, true)} command-line interface application.`,\n\t\t\t\t\t\tentry: {\n\t\t\t\t\t\t\tfile: joinPaths(this.entryPath, \"help\", \"index.ts\"),\n\t\t\t\t\t\t\tinput: { file: joinPaths(this.entryPath, \"help\", \"command.ts\") }\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisVirtual: false\n\t\t\t\t\t});\n\t\t\t\t\tawait render(this, createComponent(HelpCommand, {}));\n\t\t\t\t}\n\t\t\t},\n\t\t\tprepare: {\n\t\t\t\torder: \"post\",\n\t\t\t\tasync handler() {\n\t\t\t\t\tconst _self$ = this;\n\t\t\t\t\tconst commands = await getCommandList(this);\n\t\t\t\t\tthis.debug(`Rendering \\`help\\` built-ins for each of the ${commands.length} command modules.`);\n\t\t\t\t\tconst bin = computed(() => ({\n\t\t\t\t\t\tid: \"\",\n\t\t\t\t\t\tname: getAppName(this),\n\t\t\t\t\t\ttitle: getAppTitle(this),\n\t\t\t\t\t\tdescription: getAppDescription(this),\n\t\t\t\t\t\tisVirtual: true,\n\t\t\t\t\t\tpath: null,\n\t\t\t\t\t\tsegments: [],\n\t\t\t\t\t\talias: [],\n\t\t\t\t\t\toptions: Object.fromEntries(this.options.map((option) => [option.name, option])),\n\t\t\t\t\t\tentry: { file: joinPaths(this.entryPath, \"bin.ts\") },\n\t\t\t\t\t\targs: [],\n\t\t\t\t\t\tparent: null,\n\t\t\t\t\t\tchildren: this.commands\n\t\t\t\t\t}));\n\t\t\t\t\treturn render(this, [createComponent(Show, {\n\t\t\t\t\t\tget when() {\n\t\t\t\t\t\t\treturn _self$.config.help.builtins !== false;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tget children() {\n\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\tcreateComponent(HelpBuiltin, { get command() {\n\t\t\t\t\t\t\t\t\treturn bin.value;\n\t\t\t\t\t\t\t\t} }),\n\t\t\t\t\t\t\t\tcreateComponent(Spacing, {}),\n\t\t\t\t\t\t\t\tcreateComponent(For, {\n\t\t\t\t\t\t\t\t\tget each() {\n\t\t\t\t\t\t\t\t\t\treturn commands.sort((a, b) => a.name.localeCompare(b.name));\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tdoubleHardline: true,\n\t\t\t\t\t\t\t\t\tchildren: (command) => createComponent(HelpBuiltin, { command })\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t}\n\t\t\t\t\t})]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t];\n};\n\n//#endregion\nexport { plugin as default, plugin };\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,UAAU,UAAU,EAAE,KAAK;AAChC,QAAO;EACN,GAAG,MAAM,QAAQ,MAAM;EACvB,QAAQ,QAAQ,QAAQ;EACxB;GACC,MAAM;GACN,SAAS;GACT,SAAS;AACR,SAAK,MAAM,qEAAqE;AAChF,WAAO,EAAE,MAAM,KAAK,EAAE,SAAS,QAAQ,YAAY,QAAQ,QAAQ,YAAY,QAAQ,QAAQ,GAAG,QAAQ,UAAU,QAAQ,EAAE,SAAS,EAAE,UAAU,MAAM,CAAC,EAAE;;GAE7J,MAAM,iBAAiB;AACtB,SAAK,MAAM,sDAAsD;AACjE,QAAI,KAAK,OAAO,KAAK,YAAY,OAAO;AACvC,UAAK,WAAW,EAAE;AAClB,SAAI,KAAK,OAAO,MAAM,UAAU,MAAM,SAAS,KAAK,OAAO,KAAK,QAAQ,CAAE,MAAK,KAAK,2LAA2L;SAC1Q,MAAK,OAAO,KAAK;MACrB,IAAI,KAAK,OAAO,KAAK;MACrB,MAAM,KAAK,OAAO,KAAK;MACvB,MAAM,KAAK,OAAO,KAAK;MACvB,UAAU,CAAC,KAAK,OAAO,KAAK,QAAQ;MACpC,OAAO;MACP,aAAa,oEAAoE,YAAY,MAAM,KAAK,CAAC;MACzG,OAAO;OACN,MAAM,UAAU,KAAK,WAAW,QAAQ,WAAW;OACnD,OAAO,EAAE,MAAM,UAAU,KAAK,WAAW,QAAQ,aAAa,EAAE;OAChE;MACD,WAAW;MACX,CAAC;AACF,WAAM,OAAO,MAAM,gBAAgB,aAAa,EAAE,CAAC,CAAC;;;GAGtD,SAAS;IACR,OAAO;IACP,MAAM,UAAU;KACf,MAAM,SAAS;KACf,MAAM,WAAW,MAAM,eAAe,KAAK;AAC3C,UAAK,MAAM,gDAAgD,SAAS,OAAO,mBAAmB;KAC9F,MAAM,MAAM,gBAAgB;MAC3B,IAAI;MACJ,MAAM,WAAW,KAAK;MACtB,OAAO,YAAY,KAAK;MACxB,aAAa,kBAAkB,KAAK;MACpC,WAAW;MACX,MAAM;MACN,UAAU,EAAE;MACZ,OAAO,EAAE;MACT,SAAS,OAAO,YAAY,KAAK,QAAQ,KAAK,WAAW,CAAC,OAAO,MAAM,OAAO,CAAC,CAAC;MAChF,OAAO,EAAE,MAAM,UAAU,KAAK,WAAW,SAAS,EAAE;MACpD,MAAM,EAAE;MACR,QAAQ;MACR,UAAU,KAAK;MACf,EAAE;AACH,YAAO,OAAO,MAAM,CAAC,gBAAgB,MAAM;MAC1C,IAAI,OAAO;AACV,cAAO,OAAO,OAAO,KAAK,aAAa;;MAExC,IAAI,WAAW;AACd,cAAO;QACN,gBAAgB,aAAa,EAAE,IAAI,UAAU;AAC5C,gBAAO,IAAI;WACT,CAAC;QACJ,gBAAgB,SAAS,EAAE,CAAC;QAC5B,gBAAgB,KAAK;SACpB,IAAI,OAAO;AACV,iBAAO,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC;;SAE7D,gBAAgB;SAChB,WAAW,YAAY,gBAAgB,aAAa,EAAE,SAAS,CAAC;SAChE,CAAC;QACF;;MAEF,CAAC,CAAC,CAAC;;IAEL;GACD;EACD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../plugin-help/dist/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 ../plugin-help/dist/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":["../../../../../../../../../../../plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs"],"sourcesContent":["//#region ../../node_modules/.pnpm/@stryke+string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs\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//#endregion\nexport { isConstantCase };\n//# sourceMappingURL=constant-case.mjs.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;AAUA,SAAS,eAAe,OAAO;AAC9B,QAAO,QAAQ,eAAe,KAAK,MAAM,GAAG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../plugin-help/dist/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;
|