@shell-shock/preset-cli 0.5.1 → 0.7.0
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/components/banner-function-declaration.cjs +6 -6
- 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 +6 -6
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/command-entry.cjs +178 -120
- package/dist/components/command-entry.d.cts +2 -2
- package/dist/components/command-entry.d.mts +2 -2
- package/dist/components/command-entry.mjs +177 -119
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.d.cts +3 -3
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +2 -2
- package/dist/components/prompts-builtin.cjs +485 -57
- package/dist/components/prompts-builtin.d.cts +13 -9
- package/dist/components/prompts-builtin.d.cts.map +1 -1
- package/dist/components/prompts-builtin.d.mts +13 -9
- package/dist/components/prompts-builtin.d.mts.map +1 -1
- package/dist/components/prompts-builtin.mjs +495 -68
- package/dist/components/prompts-builtin.mjs.map +1 -1
- package/dist/components/virtual-command-entry.cjs +4 -3
- package/dist/components/virtual-command-entry.mjs +3 -2
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-upgrade/dist/components/index.cjs +2 -0
- package/dist/plugin-upgrade/dist/components/index.mjs +4 -0
- package/dist/plugin-upgrade/dist/components/upgrade-builtin.cjs +661 -0
- package/dist/plugin-upgrade/dist/components/upgrade-builtin.mjs +655 -0
- package/dist/plugin-upgrade/dist/components/upgrade-builtin.mjs.map +1 -0
- package/dist/plugin-upgrade/dist/components/upgrade-command.cjs +96 -0
- package/dist/plugin-upgrade/dist/components/upgrade-command.mjs +96 -0
- package/dist/plugin-upgrade/dist/components/upgrade-command.mjs.map +1 -0
- package/dist/plugin-upgrade/dist/index.cjs +49 -0
- package/dist/plugin-upgrade/dist/index.mjs +49 -0
- package/dist/plugin-upgrade/dist/index.mjs.map +1 -0
- package/dist/types/plugin.d.cts +6 -10
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +6 -10
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +10 -10
|
@@ -16,12 +16,12 @@ function BannerFunctionDeclaration(props) {
|
|
|
16
16
|
const { consoleFnName = "log", variant = "primary", command } = props;
|
|
17
17
|
const theme = (0, __shell_shock_preset_script_contexts_theme.useTheme)();
|
|
18
18
|
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
19
|
-
const header = (0, __alloy_js_core.computed)(() => `${theme.labels.banner.header[variant] || (0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)} v${context.packageJson.version || "1.0.0"}`);
|
|
20
|
-
const description = (0, __alloy_js_core.computed)(() => command?.description || (0, __shell_shock_core_plugin_utils_context_helpers.getAppDescription)(context));
|
|
19
|
+
const header = (0, __alloy_js_core.computed)(() => `${theme.labels.banner.header[variant] || (0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context, false)} v${context.packageJson.version || "1.0.0"}`);
|
|
21
20
|
const footer = (0, __alloy_js_core.computed)(() => theme.labels.banner.footer[variant]);
|
|
22
|
-
const title = (0, __alloy_js_core.computed)(() => (0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context
|
|
21
|
+
const title = (0, __alloy_js_core.computed)(() => (0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context, true).replace(`v${context.packageJson.version || "1.0.0"}`, ""));
|
|
22
|
+
const description = (0, __alloy_js_core.computed)(() => command?.description || (0, __shell_shock_core_plugin_utils_context_helpers.getAppDescription)(context));
|
|
23
23
|
const titleLines = (0, __alloy_js_core.computed)(() => {
|
|
24
|
-
const result = (0, cfonts.render)((0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context), {
|
|
24
|
+
const result = (0, cfonts.render)((0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context, true), {
|
|
25
25
|
font: "tiny",
|
|
26
26
|
align: "left",
|
|
27
27
|
background: "transparent",
|
|
@@ -31,7 +31,7 @@ function BannerFunctionDeclaration(props) {
|
|
|
31
31
|
transitionGradient: false,
|
|
32
32
|
env: "node"
|
|
33
33
|
});
|
|
34
|
-
if (!result) return [(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)];
|
|
34
|
+
if (!result) return [`${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context, true)} Command-Line Interface`];
|
|
35
35
|
return result.array;
|
|
36
36
|
});
|
|
37
37
|
const bannerPadding = (0, __alloy_js_core.computed)(() => Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.banner.outline[variant].left.length + theme.borderStyles.banner.outline[variant].right.length);
|
|
@@ -40,7 +40,7 @@ function BannerFunctionDeclaration(props) {
|
|
|
40
40
|
async: true,
|
|
41
41
|
name: "banner",
|
|
42
42
|
get doc() {
|
|
43
|
-
return `Write the ${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
|
|
43
|
+
return `Write the ${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context, true)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
|
|
44
44
|
},
|
|
45
45
|
parameters: [{
|
|
46
46
|
name: "pause",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
import { BannerFunctionDeclarationProps } from "@shell-shock/preset-script/components/banner-function-declaration";
|
|
3
3
|
|
|
4
4
|
//#region src/components/banner-function-declaration.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
7
7
|
*/
|
|
8
|
-
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps):
|
|
8
|
+
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core0.Children;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { BannerFunctionDeclaration };
|
|
11
11
|
//# sourceMappingURL=banner-function-declaration.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-function-declaration.d.cts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCgB,iBAAA,yBAAA,CACP,KAAA,EAAA,8BAA8B,CAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"banner-function-declaration.d.cts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCgB,iBAAA,yBAAA,CACP,KAAA,EAAA,8BAA8B,CAAA,EAAA,eAAA,CAAA,QAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core3 from "@alloy-js/core";
|
|
2
2
|
import { BannerFunctionDeclarationProps } from "@shell-shock/preset-script/components/banner-function-declaration";
|
|
3
3
|
|
|
4
4
|
//#region src/components/banner-function-declaration.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
7
7
|
*/
|
|
8
|
-
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps):
|
|
8
|
+
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core3.Children;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { BannerFunctionDeclaration };
|
|
11
11
|
//# sourceMappingURL=banner-function-declaration.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-function-declaration.d.mts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCgB,iBAAA,yBAAA,CACP,KAAA,EAAA,8BAA8B,CAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"banner-function-declaration.d.mts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCgB,iBAAA,yBAAA,CACP,KAAA,EAAA,8BAA8B,CAAA,EAAA,eAAA,CAAA,QAAA"}
|
|
@@ -15,12 +15,12 @@ function BannerFunctionDeclaration(props) {
|
|
|
15
15
|
const { consoleFnName = "log", variant = "primary", command } = props;
|
|
16
16
|
const theme = useTheme();
|
|
17
17
|
const context = usePowerlines();
|
|
18
|
-
const header = computed(() => `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || "1.0.0"}`);
|
|
19
|
-
const description = computed(() => command?.description || getAppDescription(context));
|
|
18
|
+
const header = computed(() => `${theme.labels.banner.header[variant] || getAppTitle(context, false)} v${context.packageJson.version || "1.0.0"}`);
|
|
20
19
|
const footer = computed(() => theme.labels.banner.footer[variant]);
|
|
21
|
-
const title = computed(() => getAppTitle(context
|
|
20
|
+
const title = computed(() => getAppTitle(context, true).replace(`v${context.packageJson.version || "1.0.0"}`, ""));
|
|
21
|
+
const description = computed(() => command?.description || getAppDescription(context));
|
|
22
22
|
const titleLines = computed(() => {
|
|
23
|
-
const result = render(getAppTitle(context), {
|
|
23
|
+
const result = render(getAppTitle(context, true), {
|
|
24
24
|
font: "tiny",
|
|
25
25
|
align: "left",
|
|
26
26
|
background: "transparent",
|
|
@@ -30,7 +30,7 @@ function BannerFunctionDeclaration(props) {
|
|
|
30
30
|
transitionGradient: false,
|
|
31
31
|
env: "node"
|
|
32
32
|
});
|
|
33
|
-
if (!result) return [getAppTitle(context)];
|
|
33
|
+
if (!result) return [`${getAppTitle(context, true)} Command-Line Interface`];
|
|
34
34
|
return result.array;
|
|
35
35
|
});
|
|
36
36
|
const bannerPadding = computed(() => Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.banner.outline[variant].left.length + theme.borderStyles.banner.outline[variant].right.length);
|
|
@@ -39,7 +39,7 @@ function BannerFunctionDeclaration(props) {
|
|
|
39
39
|
async: true,
|
|
40
40
|
name: "banner",
|
|
41
41
|
get doc() {
|
|
42
|
-
return `Write the ${getAppTitle(context)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
|
|
42
|
+
return `Write the ${getAppTitle(context, true)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
|
|
43
43
|
},
|
|
44
44
|
parameters: [{
|
|
45
45
|
name: "pause",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","FunctionDeclaration","IfStatement","usePowerlines","getAppDescription","getAppTitle","BannerFunctionBodyDeclaration","useTheme","render","BannerFunctionDeclaration","props","consoleFnName","variant","command","theme","context","header","labels","banner","packageJson","version","
|
|
1
|
+
{"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","FunctionDeclaration","IfStatement","usePowerlines","getAppDescription","getAppTitle","BannerFunctionBodyDeclaration","useTheme","render","BannerFunctionDeclaration","props","consoleFnName","variant","command","theme","context","header","labels","banner","packageJson","version","footer","title","replace","description","titleLines","result","font","align","background","letterSpacing","lineHeight","gradient","transitionGradient","env","array","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","value","_$createComponent","async","name","doc","parameters","type","default","children","map","line","JSON","stringify","trim","join","condition"],"sources":["../../src/components/banner-function-declaration.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, computed } from \"@alloy-js/core\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { BannerFunctionDeclarationProps } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { BannerFunctionBodyDeclaration } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { useTheme } from \"@shell-shock/preset-script/contexts/theme\";\nimport { render } from \"cfonts\";\nimport type { CLIPresetContext } from \"../types/plugin\";\n\n/**\n * A component to generate the `banner` function in the `shell-shock:console` builtin module.\n */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const { consoleFnName = \"log\", variant = \"primary\", command } = props;\n\n const theme = useTheme();\n\n const context = usePowerlines<CLIPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context, false)} v${\n context.packageJson.version || \"1.0.0\"\n }`\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n const title = computed(() =>\n getAppTitle(context, true).replace(\n `v${context.packageJson.version || \"1.0.0\"}`,\n \"\"\n )\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n\n const titleLines = computed(() => {\n const result = render(getAppTitle(context, true), {\n font: \"tiny\",\n align: \"left\",\n background: \"transparent\",\n letterSpacing: 1,\n lineHeight: 1,\n gradient: false,\n transitionGradient: false,\n env: \"node\"\n });\n if (!result) {\n return [`${getAppTitle(context, true)} Command-Line Interface`];\n }\n\n return result.array;\n });\n\n const bannerPadding = computed(\n () =>\n Math.max(theme.padding.app, 0) * 2 +\n theme.borderStyles.banner.outline[variant].left.length +\n theme.borderStyles.banner.outline[variant].right.length\n );\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n\n return (\n <>\n <FunctionDeclaration\n async\n name=\"banner\"\n doc={`Write the ${getAppTitle(context, true)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}\n parameters={[{ name: \"pause\", type: \"number\", default: 500 }]}>\n <BannerFunctionBodyDeclaration\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}>\n {code`const titleLines = [${titleLines.value\n .map(line => JSON.stringify(line.trim()))\n .join(\", \")}];\n const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${\n totalPadding.value\n }, 0) ? \"${title.value}\" : \\`\\\\n\\${titleLines.join(\"\\\\n\")}\\\\n\\`; `}\n </BannerFunctionBodyDeclaration>\n <IfStatement condition={code`isInteractive && !isHelp`}>\n {code`await sleep(pause);`}\n </IfStatement>\n </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkCA,SAAgBU,0BACdC,OACA;CACA,MAAM,EAAEC,gBAAgB,OAAOC,UAAU,WAAWC,YAAYH;CAEhE,MAAMI,QAAQP,UAAU;CAExB,MAAMQ,UAAUZ,eAAiC;CAEjD,MAAMa,SAAShB,eAEX,GAAGc,MAAMG,OAAOC,OAAOF,OAAOJ,YAAYP,YAAYU,SAAS,MAAM,CAAA,IACnEA,QAAQI,YAAYC,WAAW,UAEpC;CACD,MAAMC,SAASrB,eAAec,MAAMG,OAAOC,OAAOG,OAAOT,SAAS;CAClE,MAAMU,QAAQtB,eACZK,YAAYU,SAAS,KAAK,CAACQ,QACzB,IAAIR,QAAQI,YAAYC,WAAW,WACnC,GAEJ,CAAC;CACD,MAAMI,cAAcxB,eACZa,SAASW,eAAepB,kBAAkBW,QAClD,CAAC;CAED,MAAMU,aAAazB,eAAe;EAChC,MAAM0B,SAASlB,OAAOH,YAAYU,SAAS,KAAK,EAAE;GAChDY,MAAM;GACNC,OAAO;GACPC,YAAY;GACZC,eAAe;GACfC,YAAY;GACZC,UAAU;GACVC,oBAAoB;GACpBC,KAAK;GACN,CAAC;AACF,MAAI,CAACR,OACH,QAAO,CAAC,GAAGrB,YAAYU,SAAS,KAAK,CAAA,yBAA0B;AAGjE,SAAOW,OAAOS;GACd;CAEF,MAAMC,gBAAgBpC,eAElBqC,KAAKC,IAAIxB,MAAMyB,QAAQC,KAAK,EAAE,GAAG,IACjC1B,MAAM2B,aAAavB,OAAOwB,QAAQ9B,SAAS+B,KAAKC,SAChD9B,MAAM2B,aAAavB,OAAOwB,QAAQ9B,SAASiC,MAAMD,OACpD;CACD,MAAME,eAAe9C,eACbqC,KAAKC,IAAIxB,MAAMyB,QAAQrB,QAAQ,EAAE,GAAG,IAAIkB,cAAcW,MAC7D;AAED,QAAA,CAAAC,gBAEK/C,qBAAmB;EAClBgD,OAAK;EACLC,MAAI;EAAA,IACJC,MAAG;AAAA,UAAE,aAAa9C,YAAYU,SAAS,KAAK,CAAA,sBAC1CF,UAAU,WAAWA,QAAQS,MAAK,aAAc,GAAE;;EAEpD8B,YAAY,CAAC;GAAEF,MAAM;GAASG,MAAM;GAAUC,SAAS;GAAK,CAAC;EAAA,IAAAC,WAAA;AAAA,UAAA,CAAAP,gBAC5D1C,+BAA6B;IAAA,IAC5BU,SAAM;AAAA,YAAEA,OAAO+B;;IAAK,IACpBvB,cAAW;AAAA,YAAEA,YAAYuB;;IAAK,IAC9B1B,SAAM;AAAA,YAAEA,OAAO0B;;IACNnC;IACMD;IACNE;IAAO,IAAA0C,WAAA;AAAA,YACfxD,IAAI,uBAAuB0B,WAAWsB,MACpCS,KAAIC,SAAQC,KAAKC,UAAUF,KAAKG,MAAM,CAAC,CAAC,CACxCC,KAAK,KAAK,CAAA;wHAEbf,aAAaC,MAAK,UACTzB,MAAMyB,MAAK;;IAA4C,CAAA,EAAAC,gBAEjE9C,aAAW;IAAC4D,WAAW/D,IAAI;IAA0BwD,UACnDxD,IAAI;IAAqB,CAAA,CAAA;;EAAA,CAAA,CAAA"}
|
|
@@ -4,19 +4,19 @@ const require_components_virtual_command_entry = require('./virtual-command-entr
|
|
|
4
4
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
5
|
let __alloy_js_core = require("@alloy-js/core");
|
|
6
6
|
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
7
|
+
let __powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
|
+
let defu = require("defu");
|
|
9
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
10
|
+
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
7
11
|
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
12
|
+
let __stryke_path_join = require("@stryke/path/join");
|
|
8
13
|
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
9
|
-
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
10
|
-
let __powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
11
14
|
let __powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
12
15
|
let __shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
|
|
13
16
|
let __stryke_path_find = require("@stryke/path/find");
|
|
14
|
-
let __stryke_path_join = require("@stryke/path/join");
|
|
15
17
|
let __stryke_path_replace = require("@stryke/path/replace");
|
|
16
18
|
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
17
19
|
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
18
|
-
let defu = require("defu");
|
|
19
|
-
defu = require_rolldown_runtime.__toESM(defu);
|
|
20
20
|
|
|
21
21
|
//#region src/components/command-entry.tsx
|
|
22
22
|
/**
|
|
@@ -73,6 +73,7 @@ function CommandEntry(props) {
|
|
|
73
73
|
],
|
|
74
74
|
prompts: [
|
|
75
75
|
"text",
|
|
76
|
+
"numeric",
|
|
76
77
|
"toggle",
|
|
77
78
|
"select",
|
|
78
79
|
"isCancel",
|
|
@@ -94,83 +95,113 @@ function CommandEntry(props) {
|
|
|
94
95
|
get children() {
|
|
95
96
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandValidationLogic, { command });
|
|
96
97
|
}
|
|
97
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
98
|
-
get
|
|
99
|
-
return
|
|
98
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
99
|
+
get when() {
|
|
100
|
+
return Object.values(command.options ?? {}).filter((option) => !option.optional).length > 0 || Object.values(command.arguments ?? {}).filter((argument) => !argument.optional).length > 0;
|
|
100
101
|
},
|
|
101
102
|
get children() {
|
|
102
|
-
return
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
get
|
|
117
|
-
return
|
|
103
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
104
|
+
get condition() {
|
|
105
|
+
return __alloy_js_core.code`!isHelp && (${Object.values(command.options ?? {}).filter((option) => !option.optional).map((option) => (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && option.variadic ? `(!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} || options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0)` : `options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} === undefined`).join(" || ")}${Object.values(command.options ?? {}).filter((option) => !option.optional).length > 0 && Object.values(command.arguments ?? {}).filter((argument) => !argument.optional).length > 0 ? " || " : ""}${Object.values(command.arguments ?? {}).filter((argument) => !argument.optional).map((argument) => (argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && argument.variadic ? `(!${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} || ${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0)` : `${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} === undefined`).join(" || ")}) `;
|
|
106
|
+
},
|
|
107
|
+
get children() {
|
|
108
|
+
return [
|
|
109
|
+
__alloy_js_core.code`writeLine(""); `,
|
|
110
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
111
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
112
|
+
get each() {
|
|
113
|
+
return Object.values(command.options ?? {});
|
|
114
|
+
},
|
|
115
|
+
doubleHardline: true,
|
|
116
|
+
children: (option) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
117
|
+
get when() {
|
|
118
|
+
return !option.optional;
|
|
118
119
|
},
|
|
119
120
|
get children() {
|
|
120
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
get children() {
|
|
126
|
-
return
|
|
121
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
122
|
+
get condition() {
|
|
123
|
+
return __alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}`;
|
|
124
|
+
},
|
|
125
|
+
get children() {
|
|
126
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Switch, { get children() {
|
|
127
|
+
return [
|
|
128
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
129
|
+
get when() {
|
|
130
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
131
|
+
},
|
|
132
|
+
get children() {
|
|
133
|
+
return __alloy_js_core.code`
|
|
127
134
|
const value = await text({
|
|
128
|
-
message: "Please provide a
|
|
135
|
+
message: "Please provide a value for the \\"${option.name}\\" option",
|
|
129
136
|
${option.description ? `description: "${option.description}",
|
|
130
137
|
` : ""}validate(val) {
|
|
131
138
|
if (!val || val.trim() === "") {
|
|
132
139
|
return "A value must be provided for this option";
|
|
133
140
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}` : ""}
|
|
137
|
-
return undefined;
|
|
141
|
+
|
|
142
|
+
return null;
|
|
138
143
|
}
|
|
139
144
|
});
|
|
140
145
|
if (isCancel(value)) {
|
|
141
146
|
return;
|
|
142
147
|
}
|
|
143
148
|
|
|
144
|
-
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} =
|
|
149
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
150
|
+
`;
|
|
151
|
+
}
|
|
152
|
+
}),
|
|
153
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
154
|
+
get when() {
|
|
155
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
156
|
+
},
|
|
157
|
+
get children() {
|
|
158
|
+
return __alloy_js_core.code`
|
|
159
|
+
const value = await numeric({
|
|
160
|
+
message: "Please provide a numeric value for the \\"${option.name}\\" option",
|
|
161
|
+
${option.description ? `description: "${option.description}",
|
|
162
|
+
` : ""}
|
|
163
|
+
});
|
|
164
|
+
if (isCancel(value)) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
145
169
|
`;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
170
|
+
}
|
|
171
|
+
}),
|
|
172
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
173
|
+
get when() {
|
|
174
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean;
|
|
175
|
+
},
|
|
176
|
+
get children() {
|
|
177
|
+
return __alloy_js_core.code`
|
|
178
|
+
const value = await toggle({
|
|
179
|
+
message: "Please select a value for the \\"${option.name}\\" option",
|
|
155
180
|
${option.description ? `description: "${option.description}",
|
|
156
181
|
` : ""}
|
|
157
182
|
});
|
|
183
|
+
if (isCancel(value)) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
158
188
|
`;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
get children() {
|
|
168
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
169
|
-
get condition() {
|
|
170
|
-
return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
|
|
189
|
+
}
|
|
190
|
+
})
|
|
191
|
+
];
|
|
192
|
+
} });
|
|
193
|
+
}
|
|
194
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
195
|
+
get when() {
|
|
196
|
+
return (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && option.variadic;
|
|
171
197
|
},
|
|
172
198
|
get children() {
|
|
173
|
-
return
|
|
199
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
200
|
+
get condition() {
|
|
201
|
+
return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
|
|
202
|
+
},
|
|
203
|
+
get children() {
|
|
204
|
+
return __alloy_js_core.code`
|
|
174
205
|
const value = await text({
|
|
175
206
|
message: "Please provide one or more${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} values for the \\"${option.name}\\" option (values are separated by a \\",\\" character)",
|
|
176
207
|
${option.description ? `description: "${option.description}",
|
|
@@ -194,83 +225,108 @@ function CommandEntry(props) {
|
|
|
194
225
|
|
|
195
226
|
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = value.split(",").map(value => value.trim()).filter(Boolean)${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `.map(Number)` : ""} ;
|
|
196
227
|
`;
|
|
228
|
+
}
|
|
229
|
+
});
|
|
197
230
|
}
|
|
198
|
-
});
|
|
231
|
+
})];
|
|
199
232
|
}
|
|
200
|
-
})]
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
get when() {
|
|
212
|
-
return !argument.optional;
|
|
213
|
-
},
|
|
214
|
-
get children() {
|
|
215
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
216
|
-
get condition() {
|
|
217
|
-
return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}`;
|
|
233
|
+
})]
|
|
234
|
+
}),
|
|
235
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
236
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
237
|
+
get each() {
|
|
238
|
+
return command.arguments;
|
|
239
|
+
},
|
|
240
|
+
doubleHardline: true,
|
|
241
|
+
children: (argument) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
242
|
+
get when() {
|
|
243
|
+
return !argument.optional;
|
|
218
244
|
},
|
|
219
245
|
get children() {
|
|
220
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
get children() {
|
|
226
|
-
return
|
|
246
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
247
|
+
get condition() {
|
|
248
|
+
return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}`;
|
|
249
|
+
},
|
|
250
|
+
get children() {
|
|
251
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Switch, { get children() {
|
|
252
|
+
return [
|
|
253
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
254
|
+
get when() {
|
|
255
|
+
return argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
256
|
+
},
|
|
257
|
+
get children() {
|
|
258
|
+
return __alloy_js_core.code`
|
|
227
259
|
const value = await text({
|
|
228
|
-
message: "Please provide a
|
|
260
|
+
message: "Please provide a value for the \\"${argument.name}\\" argument",
|
|
229
261
|
${argument.description ? `description: "${argument.description}",
|
|
230
262
|
` : ""}validate(val) {
|
|
231
263
|
if (!val || val.trim() === "") {
|
|
232
264
|
return "A value must be provided for this argument";
|
|
233
265
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}` : ""}
|
|
237
|
-
return undefined;
|
|
266
|
+
|
|
267
|
+
return null;
|
|
238
268
|
}
|
|
239
269
|
});
|
|
240
270
|
if (isCancel(value)) {
|
|
241
271
|
return;
|
|
242
272
|
}
|
|
243
273
|
|
|
244
|
-
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} =
|
|
274
|
+
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = value;
|
|
245
275
|
`;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
276
|
+
}
|
|
277
|
+
}),
|
|
278
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
279
|
+
get when() {
|
|
280
|
+
return argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
281
|
+
},
|
|
282
|
+
get children() {
|
|
283
|
+
return __alloy_js_core.code`
|
|
284
|
+
const value = await numeric({
|
|
285
|
+
message: "Please provide a numeric value for the \\"${argument.name}\\" argument",
|
|
286
|
+
${argument.description ? `description: "${argument.description}",
|
|
287
|
+
` : ""}
|
|
288
|
+
});
|
|
289
|
+
if (isCancel(value)) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = value;
|
|
294
|
+
`;
|
|
295
|
+
}
|
|
296
|
+
}),
|
|
297
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
298
|
+
get when() {
|
|
299
|
+
return argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean;
|
|
300
|
+
},
|
|
301
|
+
get children() {
|
|
302
|
+
return __alloy_js_core.code`
|
|
303
|
+
const value = await toggle({
|
|
254
304
|
message: "Please select a value for the \\"${argument.name}\\" argument",
|
|
255
305
|
${argument.description ? `description: "${argument.description}",
|
|
256
306
|
` : ""}
|
|
257
307
|
});
|
|
308
|
+
if (isCancel(value)) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = value;
|
|
258
313
|
`;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
get children() {
|
|
268
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
269
|
-
get condition() {
|
|
270
|
-
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0`;
|
|
314
|
+
}
|
|
315
|
+
})
|
|
316
|
+
];
|
|
317
|
+
} });
|
|
318
|
+
}
|
|
319
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
320
|
+
get when() {
|
|
321
|
+
return (argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && argument.variadic;
|
|
271
322
|
},
|
|
272
323
|
get children() {
|
|
273
|
-
return
|
|
324
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
325
|
+
get condition() {
|
|
326
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0`;
|
|
327
|
+
},
|
|
328
|
+
get children() {
|
|
329
|
+
return __alloy_js_core.code`
|
|
274
330
|
const value = await text({
|
|
275
331
|
message: "Please provide one or more${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} (values are separated by a \\",\\" character)",
|
|
276
332
|
${argument.description ? `description: "${argument.description}",
|
|
@@ -295,16 +351,18 @@ function CommandEntry(props) {
|
|
|
295
351
|
|
|
296
352
|
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = value.split(",").map(value => value.trim()).filter(Boolean)${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `.map(Number)` : ""} ;
|
|
297
353
|
`;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
298
356
|
}
|
|
299
|
-
});
|
|
357
|
+
})];
|
|
300
358
|
}
|
|
301
|
-
})]
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
359
|
+
})]
|
|
360
|
+
}),
|
|
361
|
+
__alloy_js_core.code`writeLine(""); `,
|
|
362
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
363
|
+
];
|
|
364
|
+
}
|
|
365
|
+
});
|
|
308
366
|
}
|
|
309
367
|
})];
|
|
310
368
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
|
|
|
9
9
|
/**
|
|
10
10
|
* The command entry point for the Shell Shock project.
|
|
11
11
|
*/
|
|
12
|
-
declare function CommandEntry(props: CommandEntryProps):
|
|
12
|
+
declare function CommandEntry(props: CommandEntryProps): _alloy_js_core0.Children;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { CommandEntry, CommandEntryProps };
|
|
15
15
|
//# sourceMappingURL=command-entry.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core2 from "@alloy-js/core";
|
|
2
2
|
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
|
|
|
9
9
|
/**
|
|
10
10
|
* The command entry point for the Shell Shock project.
|
|
11
11
|
*/
|
|
12
|
-
declare function CommandEntry(props: CommandEntryProps):
|
|
12
|
+
declare function CommandEntry(props: CommandEntryProps): _alloy_js_core2.Children;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { CommandEntry, CommandEntryProps };
|
|
15
15
|
//# sourceMappingURL=command-entry.d.mts.map
|