@shell-shock/preset-cli 0.3.0 → 0.4.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/README.md +1 -1
- package/dist/components/banner-function-declaration.cjs +11 -2
- package/dist/components/banner-function-declaration.d.cts +2 -2
- package/dist/components/banner-function-declaration.d.mts +2 -2
- package/dist/components/banner-function-declaration.mjs +12 -3
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/command-entry.cjs +45 -59
- 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.map +1 -1
- package/dist/components/command-entry.mjs +45 -59
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +24 -32
- 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 +25 -33
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/index.cjs +11 -0
- package/dist/components/index.d.cts +3 -1
- package/dist/components/index.d.mts +3 -1
- package/dist/components/index.mjs +3 -1
- package/dist/components/prompts-builtin.cjs +2284 -0
- package/dist/components/prompts-builtin.d.cts +36 -0
- package/dist/components/prompts-builtin.d.cts.map +1 -0
- package/dist/components/prompts-builtin.d.mts +36 -0
- package/dist/components/prompts-builtin.d.mts.map +1 -0
- package/dist/components/prompts-builtin.mjs +2277 -0
- package/dist/components/prompts-builtin.mjs.map +1 -0
- package/dist/components/virtual-command-entry.cjs +8 -6
- package/dist/components/virtual-command-entry.d.cts +2 -2
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts +2 -2
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +8 -6
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +2 -2
- package/dist/helpers/get-default-options.mjs +2 -2
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +16 -25
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +16 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +29 -15
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the ⚡<b>Shell Shock</b> monorepo. The Shell Shock pack
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://stormsoftware.com/projects/shell-shock/) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
|
@@ -37,12 +37,18 @@ function BannerFunctionDeclaration(props) {
|
|
|
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);
|
|
38
38
|
const totalPadding = (0, __alloy_js_core.computed)(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);
|
|
39
39
|
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
|
|
40
|
+
async: true,
|
|
40
41
|
name: "banner",
|
|
41
42
|
get doc() {
|
|
42
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
44
|
},
|
|
45
|
+
parameters: [{
|
|
46
|
+
name: "pause",
|
|
47
|
+
type: "number",
|
|
48
|
+
default: 250
|
|
49
|
+
}],
|
|
44
50
|
get children() {
|
|
45
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_banner_function_declaration.BannerFunctionBodyDeclaration, {
|
|
51
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_banner_function_declaration.BannerFunctionBodyDeclaration, {
|
|
46
52
|
get header() {
|
|
47
53
|
return header.value;
|
|
48
54
|
},
|
|
@@ -59,7 +65,10 @@ function BannerFunctionDeclaration(props) {
|
|
|
59
65
|
return __alloy_js_core.code`const titleLines = [${titleLines.value.map((line) => JSON.stringify(line.trim())).join(", ")}];
|
|
60
66
|
const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0) ? "${title.value}" : \`\\n\${titleLines.join("\\n")}\\n\`; `;
|
|
61
67
|
}
|
|
62
|
-
})
|
|
68
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
69
|
+
condition: __alloy_js_core.code`isInteractive && !isHelp`,
|
|
70
|
+
children: __alloy_js_core.code`await sleep(pause);`
|
|
71
|
+
})];
|
|
63
72
|
}
|
|
64
73
|
})];
|
|
65
74
|
}
|
|
@@ -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,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.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { code, computed } from "@alloy-js/core";
|
|
3
|
-
import { FunctionDeclaration } from "@alloy-js/typescript";
|
|
3
|
+
import { FunctionDeclaration, IfStatement } from "@alloy-js/typescript";
|
|
4
4
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
5
5
|
import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
6
6
|
import { BannerFunctionBodyDeclaration } from "@shell-shock/preset-script/components/banner-function-declaration";
|
|
@@ -36,12 +36,18 @@ function BannerFunctionDeclaration(props) {
|
|
|
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);
|
|
37
37
|
const totalPadding = computed(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);
|
|
38
38
|
return [createComponent(FunctionDeclaration, {
|
|
39
|
+
async: true,
|
|
39
40
|
name: "banner",
|
|
40
41
|
get doc() {
|
|
41
42
|
return `Write the ${getAppTitle(context)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
|
|
42
43
|
},
|
|
44
|
+
parameters: [{
|
|
45
|
+
name: "pause",
|
|
46
|
+
type: "number",
|
|
47
|
+
default: 250
|
|
48
|
+
}],
|
|
43
49
|
get children() {
|
|
44
|
-
return createComponent(BannerFunctionBodyDeclaration, {
|
|
50
|
+
return [createComponent(BannerFunctionBodyDeclaration, {
|
|
45
51
|
get header() {
|
|
46
52
|
return header.value;
|
|
47
53
|
},
|
|
@@ -58,7 +64,10 @@ function BannerFunctionDeclaration(props) {
|
|
|
58
64
|
return code`const titleLines = [${titleLines.value.map((line) => JSON.stringify(line.trim())).join(", ")}];
|
|
59
65
|
const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0) ? "${title.value}" : \`\\n\${titleLines.join("\\n")}\\n\`; `;
|
|
60
66
|
}
|
|
61
|
-
})
|
|
67
|
+
}), createComponent(IfStatement, {
|
|
68
|
+
condition: code`isInteractive && !isHelp`,
|
|
69
|
+
children: code`await sleep(pause);`
|
|
70
|
+
})];
|
|
62
71
|
}
|
|
63
72
|
})];
|
|
64
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","FunctionDeclaration","usePowerlines","getAppDescription","getAppTitle","BannerFunctionBodyDeclaration","useTheme","render","BannerFunctionDeclaration","props","consoleFnName","variant","command","theme","context","header","labels","banner","packageJson","version","description","footer","title","test","value","toLowerCase","replace","trim","titleLines","result","font","align","background","letterSpacing","lineHeight","gradient","transitionGradient","env","array","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","_$createComponent","name","doc","children","map","line","JSON","stringify","join"],"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 } 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)} v${context.packageJson.version || \"1.0.0\"}`\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n\n const title = computed(() =>\n getAppTitle(context) ||\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n header.value.toLowerCase()\n )\n ? header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()\n : `${header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()} Command-Line Application`\n );\n\n const titleLines = computed(() => {\n const result = render(getAppTitle(context), {\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)];\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 name=\"banner\"\n doc={`Write the ${getAppTitle(context)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}>\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 </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkCA,
|
|
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","description","footer","title","test","value","toLowerCase","replace","trim","titleLines","result","font","align","background","letterSpacing","lineHeight","gradient","transitionGradient","env","array","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","_$createComponent","async","name","doc","parameters","type","default","children","map","line","JSON","stringify","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)} v${context.packageJson.version || \"1.0.0\"}`\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n\n const title = computed(() =>\n getAppTitle(context) ||\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n header.value.toLowerCase()\n )\n ? header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()\n : `${header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()} Command-Line Application`\n );\n\n const titleLines = computed(() => {\n const result = render(getAppTitle(context), {\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)];\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)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}\n parameters={[{ name: \"pause\", type: \"number\", default: 250 }]}>\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,QAAQ,CAAA,IAAKA,QAAQI,YAAYC,WAAW,UACrG;CACD,MAAMC,cAAcrB,eACZa,SAASQ,eAAejB,kBAAkBW,QAClD,CAAC;CACD,MAAMO,SAAStB,eAAec,MAAMG,OAAOC,OAAOI,OAAOV,SAAS;CAElE,MAAMW,QAAQvB,eACZK,YAAYU,QAAQ,IACpB,4DAA4DS,KAC1DR,OAAOS,MAAMC,aACf,CAAC,GACGV,OAAOS,MACJE,QAAQ,IAAIZ,QAAQI,YAAYC,WAAW,WAAW,GAAG,CACzDQ,MAAM,GACT,GAAGZ,OAAOS,MACPE,QAAQ,IAAIZ,QAAQI,YAAYC,WAAW,WAAW,GAAG,CACzDQ,MAAM,CAAA,2BACd;CAED,MAAMC,aAAa7B,eAAe;EAChC,MAAM8B,SAAStB,OAAOH,YAAYU,QAAQ,EAAE;GAC1CgB,MAAM;GACNC,OAAO;GACPC,YAAY;GACZC,eAAe;GACfC,YAAY;GACZC,UAAU;GACVC,oBAAoB;GACpBC,KAAK;GACN,CAAC;AACF,MAAI,CAACR,OACH,QAAO,CAACzB,YAAYU,QAAQ,CAAC;AAG/B,SAAOe,OAAOS;GACd;CAEF,MAAMC,gBAAgBxC,eAElByC,KAAKC,IAAI5B,MAAM6B,QAAQC,KAAK,EAAE,GAAG,IACjC9B,MAAM+B,aAAa3B,OAAO4B,QAAQlC,SAASmC,KAAKC,SAChDlC,MAAM+B,aAAa3B,OAAO4B,QAAQlC,SAASqC,MAAMD,OACpD;CACD,MAAME,eAAelD,eACbyC,KAAKC,IAAI5B,MAAM6B,QAAQzB,QAAQ,EAAE,GAAG,IAAIsB,cAAcf,MAC7D;AAED,QAAA,CAAA0B,gBAEKlD,qBAAmB;EAClBmD,OAAK;EACLC,MAAI;EAAA,IACJC,MAAG;AAAA,UAAE,aAAajD,YAAYU,QAAQ,CAAA,sBACpCF,UAAU,WAAWA,QAAQU,MAAK,aAAc,GAAE;;EAEpDgC,YAAY,CAAC;GAAEF,MAAM;GAASG,MAAM;GAAUC,SAAS;GAAK,CAAC;EAAA,IAAAC,WAAA;AAAA,UAAA,CAAAP,gBAC5D7C,+BAA6B;IAAA,IAC5BU,SAAM;AAAA,YAAEA,OAAOS;;IAAK,IACpBJ,cAAW;AAAA,YAAEA,YAAYI;;IAAK,IAC9BH,SAAM;AAAA,YAAEA,OAAOG;;IACNb;IACMD;IACNE;IAAO,IAAA6C,WAAA;AAAA,YACf3D,IAAI,uBAAuB8B,WAAWJ,MACpCkC,KAAIC,SAAQC,KAAKC,UAAUF,KAAKhC,MAAM,CAAC,CAAC,CACxCmC,KAAK,KAAK,CAAA;wHAEbb,aAAazB,MAAK,UACTF,MAAME,MAAK;;IAA4C,CAAA,EAAA0B,gBAEjEjD,aAAW;IAAC8D,WAAWjE,IAAI;IAA0B2D,UACnD3D,IAAI;IAAqB,CAAA,CAAA;;EAAA,CAAA,CAAA"}
|
|
@@ -7,12 +7,14 @@ let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
|
7
7
|
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
8
8
|
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
9
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");
|
|
10
11
|
let __powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
11
12
|
let __shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
|
|
12
13
|
let __stryke_path_find = require("@stryke/path/find");
|
|
13
14
|
let __stryke_path_join = require("@stryke/path/join");
|
|
14
15
|
let __stryke_path_replace = require("@stryke/path/replace");
|
|
15
16
|
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
17
|
+
let __stryke_string_format_lower_case_first = require("@stryke/string-format/lower-case-first");
|
|
16
18
|
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
17
19
|
let defu = require("defu");
|
|
18
20
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
@@ -58,12 +60,7 @@ function CommandEntry(props) {
|
|
|
58
60
|
"colors",
|
|
59
61
|
"stripAnsi",
|
|
60
62
|
"writeLine",
|
|
61
|
-
"splitText"
|
|
62
|
-
"text",
|
|
63
|
-
"confirm",
|
|
64
|
-
"isCancel",
|
|
65
|
-
"intro",
|
|
66
|
-
"outro"
|
|
63
|
+
"splitText"
|
|
67
64
|
],
|
|
68
65
|
utils: [
|
|
69
66
|
"useApp",
|
|
@@ -74,6 +71,13 @@ function CommandEntry(props) {
|
|
|
74
71
|
"isHelp",
|
|
75
72
|
"isUnicodeSupported",
|
|
76
73
|
"internal_commandContext"
|
|
74
|
+
],
|
|
75
|
+
prompts: [
|
|
76
|
+
"text",
|
|
77
|
+
"toggle",
|
|
78
|
+
"select",
|
|
79
|
+
"isCancel",
|
|
80
|
+
"sleep"
|
|
77
81
|
]
|
|
78
82
|
});
|
|
79
83
|
},
|
|
@@ -84,6 +88,7 @@ function CommandEntry(props) {
|
|
|
84
88
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
85
89
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandHandlerDeclaration, {
|
|
86
90
|
command,
|
|
91
|
+
banner: __alloy_js_core.code`await banner(); `,
|
|
87
92
|
get children() {
|
|
88
93
|
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
89
94
|
condition: __alloy_js_core.code`!isInteractive`,
|
|
@@ -96,11 +101,8 @@ function CommandEntry(props) {
|
|
|
96
101
|
},
|
|
97
102
|
get children() {
|
|
98
103
|
return [
|
|
99
|
-
__alloy_js_core.code`writeLine("");
|
|
100
|
-
|
|
101
|
-
intro("Select required input parameters"); `,
|
|
102
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
103
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
104
|
+
__alloy_js_core.code`writeLine(""); `,
|
|
105
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
104
106
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
105
107
|
get each() {
|
|
106
108
|
return Object.values(command.options ?? {});
|
|
@@ -124,15 +126,12 @@ function CommandEntry(props) {
|
|
|
124
126
|
get children() {
|
|
125
127
|
return __alloy_js_core.code`
|
|
126
128
|
const value = await text({
|
|
127
|
-
message:
|
|
128
|
-
validate(
|
|
129
|
-
if (
|
|
130
|
-
return
|
|
129
|
+
message: "Please provide a${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} value for the \\"${option.name}\\" option${option.description ? ` (${(0, __stryke_string_format_lower_case_first.lowerCaseFirst)(option.description).replace(/\.+$/, "")})` : ""}",
|
|
130
|
+
validate(val) {
|
|
131
|
+
if (!val || val.trim() === "") {
|
|
132
|
+
return "A value must be provided for this option";
|
|
131
133
|
}
|
|
132
|
-
if (
|
|
133
|
-
return "A value is required for this option";
|
|
134
|
-
}
|
|
135
|
-
${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `if (Number.isNaN(Number(value))) {
|
|
134
|
+
${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `if (Number.isNaN(Number(val))) {
|
|
136
135
|
return "The value provided must be a valid number";
|
|
137
136
|
}` : ""}
|
|
138
137
|
return undefined;
|
|
@@ -151,8 +150,8 @@ function CommandEntry(props) {
|
|
|
151
150
|
},
|
|
152
151
|
get children() {
|
|
153
152
|
return __alloy_js_core.code`
|
|
154
|
-
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = await
|
|
155
|
-
message:
|
|
153
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = await toggle({
|
|
154
|
+
message: "Please select a value for the "${option.name}" option${option.description ? ` (${(0, __stryke_string_format_lower_case_first.lowerCaseFirst)(option.description).replace(/\.+$/, "")})` : ""}"
|
|
156
155
|
});
|
|
157
156
|
`;
|
|
158
157
|
}
|
|
@@ -171,18 +170,15 @@ function CommandEntry(props) {
|
|
|
171
170
|
get children() {
|
|
172
171
|
return __alloy_js_core.code`
|
|
173
172
|
const value = await text({
|
|
174
|
-
message:
|
|
175
|
-
validate(
|
|
176
|
-
if (
|
|
177
|
-
return
|
|
178
|
-
}
|
|
179
|
-
if (!value || value.trim() === "") {
|
|
180
|
-
return "A value is required for this option";
|
|
173
|
+
message: "Please provide one or more${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} values for the \\"${option.name}\\" option${option.description ? ` (${(0, __stryke_string_format_lower_case_first.lowerCaseFirst)(option.description).replace(/\.+$/, "")})` : ""} - values are separated by a \\",\\" character",
|
|
174
|
+
validate(val) {
|
|
175
|
+
if (!val || val.trim() === "") {
|
|
176
|
+
return "A value must be provided for this option";
|
|
181
177
|
}
|
|
182
|
-
if (
|
|
183
|
-
return "At least one value
|
|
178
|
+
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
179
|
+
return "At least one value must be provided for this option";
|
|
184
180
|
}
|
|
185
|
-
${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `const invalidIndex =
|
|
181
|
+
${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
|
|
186
182
|
if (invalidIndex !== -1) {
|
|
187
183
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
188
184
|
} ` : ""}
|
|
@@ -202,8 +198,7 @@ function CommandEntry(props) {
|
|
|
202
198
|
}
|
|
203
199
|
})]
|
|
204
200
|
}),
|
|
205
|
-
(0, __alloy_js_core_jsx_runtime.
|
|
206
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
201
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
207
202
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
208
203
|
get each() {
|
|
209
204
|
return command.arguments;
|
|
@@ -227,16 +222,13 @@ function CommandEntry(props) {
|
|
|
227
222
|
get children() {
|
|
228
223
|
return __alloy_js_core.code`
|
|
229
224
|
const value = await text({
|
|
230
|
-
message:
|
|
231
|
-
validate(
|
|
232
|
-
if (
|
|
233
|
-
return
|
|
234
|
-
}
|
|
235
|
-
if (!value || value.trim() === "") {
|
|
236
|
-
return "A value is required for this positional argument";
|
|
225
|
+
message: "Please provide a${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} value for the \\"${argument.name}\\" argument${argument.description ? ` (${(0, __stryke_string_format_lower_case_first.lowerCaseFirst)(argument.description).replace(/\.+$/, "")})` : ""}",
|
|
226
|
+
validate(val) {
|
|
227
|
+
if (!val || val.trim() === "") {
|
|
228
|
+
return "A value must be provided for this argument";
|
|
237
229
|
}
|
|
238
|
-
${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `if (Number.isNaN(Number(
|
|
239
|
-
return "The value
|
|
230
|
+
${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `if (Number.isNaN(Number(val))) {
|
|
231
|
+
return "The provided value must be a valid number";
|
|
240
232
|
}` : ""}
|
|
241
233
|
return undefined;
|
|
242
234
|
}
|
|
@@ -254,8 +246,8 @@ function CommandEntry(props) {
|
|
|
254
246
|
},
|
|
255
247
|
get children() {
|
|
256
248
|
return __alloy_js_core.code`
|
|
257
|
-
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = await
|
|
258
|
-
message: 'Please select a value for the ${argument.
|
|
249
|
+
${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} = await toggle({
|
|
250
|
+
message: 'Please select a value for the "${argument.name}" argument${argument.description ? ` (${(0, __stryke_string_format_lower_case_first.lowerCaseFirst)(argument.description).replace(/\.+$/, "")})` : ""}:'
|
|
259
251
|
});
|
|
260
252
|
`;
|
|
261
253
|
}
|
|
@@ -274,18 +266,15 @@ function CommandEntry(props) {
|
|
|
274
266
|
get children() {
|
|
275
267
|
return __alloy_js_core.code`
|
|
276
268
|
const value = await text({
|
|
277
|
-
message:
|
|
278
|
-
validate(
|
|
279
|
-
if (
|
|
280
|
-
return
|
|
281
|
-
}
|
|
282
|
-
if (!value || value.trim() === "") {
|
|
283
|
-
return "A value is required for this option";
|
|
269
|
+
message: "Please provide one or more${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? " numeric" : ""} values for the \\"${argument.name}\\" argument${argument.description ? ` (${(0, __stryke_string_format_lower_case_first.lowerCaseFirst)(argument.description).replace(/\.+$/, "")})` : ""} - values are separated by a \\",\\" character",
|
|
270
|
+
validate(val) {
|
|
271
|
+
if (!val || val.trim() === "") {
|
|
272
|
+
return "A value must be provided for this argument";
|
|
284
273
|
}
|
|
285
|
-
if (
|
|
286
|
-
return "At least one value
|
|
274
|
+
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
275
|
+
return "At least one value must be provided for this argument";
|
|
287
276
|
}
|
|
288
|
-
${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `const invalidIndex =
|
|
277
|
+
${argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
|
|
289
278
|
if (invalidIndex !== -1) {
|
|
290
279
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
291
280
|
} ` : ""}
|
|
@@ -306,11 +295,8 @@ function CommandEntry(props) {
|
|
|
306
295
|
}
|
|
307
296
|
})]
|
|
308
297
|
}),
|
|
309
|
-
__alloy_js_core.code`
|
|
310
|
-
|
|
311
|
-
writeLine(""); `,
|
|
312
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
313
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
298
|
+
__alloy_js_core.code`writeLine(""); `,
|
|
299
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
314
300
|
];
|
|
315
301
|
}
|
|
316
302
|
})];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core3 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_core3.Children;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { CommandEntry, CommandEntryProps };
|
|
15
15
|
//# sourceMappingURL=command-entry.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UA0CiB,iBAAA,SACP,KAAK;WACJ;;AAFX;;;AACU,iBAOM,YAAA,CAPN,KAAA,EAO0B,iBAP1B,CAAA,EAO2C,eAAA,CAAA,QAP3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UA0CiB,iBAAA,SACP,KAAK;WACJ;;AAFX;;;AACU,iBAOM,YAAA,CAPN,KAAA,EAO0B,iBAP1B,CAAA,EAO2C,eAAA,CAAA,QAP3C"}
|
|
@@ -6,12 +6,14 @@ import { ElseIfClause, IfStatement } from "@alloy-js/typescript";
|
|
|
6
6
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
7
7
|
import { isDynamicPathSegment } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
8
8
|
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
9
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
9
10
|
import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
10
11
|
import { CommandHandlerDeclaration, CommandValidationLogic } from "@shell-shock/preset-script/components/command-entry";
|
|
11
12
|
import { findFilePath, relativePath } from "@stryke/path/find";
|
|
12
13
|
import { joinPaths } from "@stryke/path/join";
|
|
13
14
|
import { replaceExtension } from "@stryke/path/replace";
|
|
14
15
|
import { camelCase } from "@stryke/string-format/camel-case";
|
|
16
|
+
import { lowerCaseFirst } from "@stryke/string-format/lower-case-first";
|
|
15
17
|
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
16
18
|
import defu from "defu";
|
|
17
19
|
|
|
@@ -56,12 +58,7 @@ function CommandEntry(props) {
|
|
|
56
58
|
"colors",
|
|
57
59
|
"stripAnsi",
|
|
58
60
|
"writeLine",
|
|
59
|
-
"splitText"
|
|
60
|
-
"text",
|
|
61
|
-
"confirm",
|
|
62
|
-
"isCancel",
|
|
63
|
-
"intro",
|
|
64
|
-
"outro"
|
|
61
|
+
"splitText"
|
|
65
62
|
],
|
|
66
63
|
utils: [
|
|
67
64
|
"useApp",
|
|
@@ -72,6 +69,13 @@ function CommandEntry(props) {
|
|
|
72
69
|
"isHelp",
|
|
73
70
|
"isUnicodeSupported",
|
|
74
71
|
"internal_commandContext"
|
|
72
|
+
],
|
|
73
|
+
prompts: [
|
|
74
|
+
"text",
|
|
75
|
+
"toggle",
|
|
76
|
+
"select",
|
|
77
|
+
"isCancel",
|
|
78
|
+
"sleep"
|
|
75
79
|
]
|
|
76
80
|
});
|
|
77
81
|
},
|
|
@@ -82,6 +86,7 @@ function CommandEntry(props) {
|
|
|
82
86
|
createIntrinsic("hbr", {}),
|
|
83
87
|
createComponent(CommandHandlerDeclaration, {
|
|
84
88
|
command,
|
|
89
|
+
banner: code`await banner(); `,
|
|
85
90
|
get children() {
|
|
86
91
|
return [createComponent(IfStatement, {
|
|
87
92
|
condition: code`!isInteractive`,
|
|
@@ -94,11 +99,8 @@ function CommandEntry(props) {
|
|
|
94
99
|
},
|
|
95
100
|
get children() {
|
|
96
101
|
return [
|
|
97
|
-
code`writeLine("");
|
|
98
|
-
|
|
99
|
-
intro("Select required input parameters"); `,
|
|
100
|
-
createIntrinsic("hbr", {}),
|
|
101
|
-
createIntrinsic("hbr", {}),
|
|
102
|
+
code`writeLine(""); `,
|
|
103
|
+
createComponent(Spacing, {}),
|
|
102
104
|
createComponent(For, {
|
|
103
105
|
get each() {
|
|
104
106
|
return Object.values(command.options ?? {});
|
|
@@ -122,15 +124,12 @@ function CommandEntry(props) {
|
|
|
122
124
|
get children() {
|
|
123
125
|
return code`
|
|
124
126
|
const value = await text({
|
|
125
|
-
message:
|
|
126
|
-
validate(
|
|
127
|
-
if (
|
|
128
|
-
return
|
|
127
|
+
message: "Please provide a${option.kind === ReflectionKind.number ? " numeric" : ""} value for the \\"${option.name}\\" option${option.description ? ` (${lowerCaseFirst(option.description).replace(/\.+$/, "")})` : ""}",
|
|
128
|
+
validate(val) {
|
|
129
|
+
if (!val || val.trim() === "") {
|
|
130
|
+
return "A value must be provided for this option";
|
|
129
131
|
}
|
|
130
|
-
if (
|
|
131
|
-
return "A value is required for this option";
|
|
132
|
-
}
|
|
133
|
-
${option.kind === ReflectionKind.number ? `if (Number.isNaN(Number(value))) {
|
|
132
|
+
${option.kind === ReflectionKind.number ? `if (Number.isNaN(Number(val))) {
|
|
134
133
|
return "The value provided must be a valid number";
|
|
135
134
|
}` : ""}
|
|
136
135
|
return undefined;
|
|
@@ -149,8 +148,8 @@ function CommandEntry(props) {
|
|
|
149
148
|
},
|
|
150
149
|
get children() {
|
|
151
150
|
return code`
|
|
152
|
-
options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} = await
|
|
153
|
-
message:
|
|
151
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} = await toggle({
|
|
152
|
+
message: "Please select a value for the "${option.name}" option${option.description ? ` (${lowerCaseFirst(option.description).replace(/\.+$/, "")})` : ""}"
|
|
154
153
|
});
|
|
155
154
|
`;
|
|
156
155
|
}
|
|
@@ -169,18 +168,15 @@ function CommandEntry(props) {
|
|
|
169
168
|
get children() {
|
|
170
169
|
return code`
|
|
171
170
|
const value = await text({
|
|
172
|
-
message:
|
|
173
|
-
validate(
|
|
174
|
-
if (
|
|
175
|
-
return
|
|
176
|
-
}
|
|
177
|
-
if (!value || value.trim() === "") {
|
|
178
|
-
return "A value is required for this option";
|
|
171
|
+
message: "Please provide one or more${option.kind === ReflectionKind.number ? " numeric" : ""} values for the \\"${option.name}\\" option${option.description ? ` (${lowerCaseFirst(option.description).replace(/\.+$/, "")})` : ""} - values are separated by a \\",\\" character",
|
|
172
|
+
validate(val) {
|
|
173
|
+
if (!val || val.trim() === "") {
|
|
174
|
+
return "A value must be provided for this option";
|
|
179
175
|
}
|
|
180
|
-
if (
|
|
181
|
-
return "At least one value
|
|
176
|
+
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
177
|
+
return "At least one value must be provided for this option";
|
|
182
178
|
}
|
|
183
|
-
${option.kind === ReflectionKind.number ? `const invalidIndex =
|
|
179
|
+
${option.kind === ReflectionKind.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
|
|
184
180
|
if (invalidIndex !== -1) {
|
|
185
181
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
186
182
|
} ` : ""}
|
|
@@ -200,8 +196,7 @@ function CommandEntry(props) {
|
|
|
200
196
|
}
|
|
201
197
|
})]
|
|
202
198
|
}),
|
|
203
|
-
|
|
204
|
-
createIntrinsic("hbr", {}),
|
|
199
|
+
createComponent(Spacing, {}),
|
|
205
200
|
createComponent(For, {
|
|
206
201
|
get each() {
|
|
207
202
|
return command.arguments;
|
|
@@ -225,16 +220,13 @@ function CommandEntry(props) {
|
|
|
225
220
|
get children() {
|
|
226
221
|
return code`
|
|
227
222
|
const value = await text({
|
|
228
|
-
message:
|
|
229
|
-
validate(
|
|
230
|
-
if (
|
|
231
|
-
return
|
|
232
|
-
}
|
|
233
|
-
if (!value || value.trim() === "") {
|
|
234
|
-
return "A value is required for this positional argument";
|
|
223
|
+
message: "Please provide a${argument.kind === ReflectionKind.number ? " numeric" : ""} value for the \\"${argument.name}\\" argument${argument.description ? ` (${lowerCaseFirst(argument.description).replace(/\.+$/, "")})` : ""}",
|
|
224
|
+
validate(val) {
|
|
225
|
+
if (!val || val.trim() === "") {
|
|
226
|
+
return "A value must be provided for this argument";
|
|
235
227
|
}
|
|
236
|
-
${argument.kind === ReflectionKind.number ? `if (Number.isNaN(Number(
|
|
237
|
-
return "The value
|
|
228
|
+
${argument.kind === ReflectionKind.number ? `if (Number.isNaN(Number(val))) {
|
|
229
|
+
return "The provided value must be a valid number";
|
|
238
230
|
}` : ""}
|
|
239
231
|
return undefined;
|
|
240
232
|
}
|
|
@@ -252,8 +244,8 @@ function CommandEntry(props) {
|
|
|
252
244
|
},
|
|
253
245
|
get children() {
|
|
254
246
|
return code`
|
|
255
|
-
${camelCase(argument.name)} = await
|
|
256
|
-
message: 'Please select a value for the ${argument.
|
|
247
|
+
${camelCase(argument.name)} = await toggle({
|
|
248
|
+
message: 'Please select a value for the "${argument.name}" argument${argument.description ? ` (${lowerCaseFirst(argument.description).replace(/\.+$/, "")})` : ""}:'
|
|
257
249
|
});
|
|
258
250
|
`;
|
|
259
251
|
}
|
|
@@ -272,18 +264,15 @@ function CommandEntry(props) {
|
|
|
272
264
|
get children() {
|
|
273
265
|
return code`
|
|
274
266
|
const value = await text({
|
|
275
|
-
message:
|
|
276
|
-
validate(
|
|
277
|
-
if (
|
|
278
|
-
return
|
|
279
|
-
}
|
|
280
|
-
if (!value || value.trim() === "") {
|
|
281
|
-
return "A value is required for this option";
|
|
267
|
+
message: "Please provide one or more${argument.kind === ReflectionKind.number ? " numeric" : ""} values for the \\"${argument.name}\\" argument${argument.description ? ` (${lowerCaseFirst(argument.description).replace(/\.+$/, "")})` : ""} - values are separated by a \\",\\" character",
|
|
268
|
+
validate(val) {
|
|
269
|
+
if (!val || val.trim() === "") {
|
|
270
|
+
return "A value must be provided for this argument";
|
|
282
271
|
}
|
|
283
|
-
if (
|
|
284
|
-
return "At least one value
|
|
272
|
+
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
273
|
+
return "At least one value must be provided for this argument";
|
|
285
274
|
}
|
|
286
|
-
${argument.kind === ReflectionKind.number ? `const invalidIndex =
|
|
275
|
+
${argument.kind === ReflectionKind.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
|
|
287
276
|
if (invalidIndex !== -1) {
|
|
288
277
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
289
278
|
} ` : ""}
|
|
@@ -304,11 +293,8 @@ function CommandEntry(props) {
|
|
|
304
293
|
}
|
|
305
294
|
})]
|
|
306
295
|
}),
|
|
307
|
-
code`
|
|
308
|
-
|
|
309
|
-
writeLine(""); `,
|
|
310
|
-
createIntrinsic("hbr", {}),
|
|
311
|
-
createIntrinsic("hbr", {})
|
|
296
|
+
code`writeLine(""); `,
|
|
297
|
+
createComponent(Spacing, {})
|
|
312
298
|
];
|
|
313
299
|
}
|
|
314
300
|
})];
|