@shell-shock/preset-cli 0.7.12 → 0.8.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 +15 -15
- 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 +1 -1
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/command-entry.cjs +128 -89
- package/dist/components/command-entry.d.cts +3 -3
- 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 +127 -88
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +5 -4
- package/dist/components/command-router.d.cts +5 -5
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/command-router.d.mts +2 -2
- package/dist/components/command-router.d.mts.map +1 -1
- package/dist/components/command-router.mjs +3 -2
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/virtual-command-entry.cjs +2 -2
- package/dist/components/virtual-command-entry.d.cts +3 -3
- package/dist/components/virtual-command-entry.d.mts +3 -3
- package/dist/components/virtual-command-entry.mjs +1 -1
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +3 -3
- package/dist/helpers/get-default-options.mjs +3 -3
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/types/plugin.d.cts +1 -2
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +1 -2
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +14 -14
|
@@ -4,7 +4,7 @@ let __alloy_js_core = require("@alloy-js/core");
|
|
|
4
4
|
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
5
5
|
let __powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
6
6
|
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
7
|
-
let
|
|
7
|
+
let __shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
8
8
|
let __shell_shock_plugin_theme_contexts_theme = require("@shell-shock/plugin-theme/contexts/theme");
|
|
9
9
|
let __shell_shock_preset_script_components_banner_function_declaration = require("@shell-shock/preset-script/components/banner-function-declaration");
|
|
10
10
|
let cfonts = require("cfonts");
|
|
@@ -17,12 +17,12 @@ function BannerFunctionDeclaration(props) {
|
|
|
17
17
|
const { consoleFnName = "log", variant = "primary", command } = props;
|
|
18
18
|
const theme = (0, __shell_shock_plugin_theme_contexts_theme.useTheme)();
|
|
19
19
|
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
20
|
-
const header = (0, __alloy_js_core.computed)(() => `${theme.labels.banner.header[variant] || (0,
|
|
20
|
+
const header = (0, __alloy_js_core.computed)(() => `${theme.labels.banner.header[variant] || (0, __shell_shock_core_plugin_utils.getAppTitle)(context)} v${context.packageJson.version || "1.0.0"}`);
|
|
21
21
|
const footer = (0, __alloy_js_core.computed)(() => theme.labels.banner.footer[variant]);
|
|
22
|
-
const title = (0, __alloy_js_core.computed)(() => (0,
|
|
23
|
-
const description = (0, __alloy_js_core.computed)(() => command?.description || (0,
|
|
22
|
+
const title = (0, __alloy_js_core.computed)(() => (0, __shell_shock_core_plugin_utils.getAppTitle)(context, true).replace(`v${context.packageJson.version || "1.0.0"}`, ""));
|
|
23
|
+
const description = (0, __alloy_js_core.computed)(() => command?.description || (0, __shell_shock_core_plugin_utils.getAppDescription)(context));
|
|
24
24
|
const titleLines = (0, __alloy_js_core.computed)(() => {
|
|
25
|
-
const result = (0, cfonts.render)((0,
|
|
25
|
+
const result = (0, cfonts.render)((0, __shell_shock_core_plugin_utils.getAppTitle)(context, true), {
|
|
26
26
|
font: "tiny",
|
|
27
27
|
align: "left",
|
|
28
28
|
background: "transparent",
|
|
@@ -32,7 +32,7 @@ function BannerFunctionDeclaration(props) {
|
|
|
32
32
|
transitionGradient: false,
|
|
33
33
|
env: "node"
|
|
34
34
|
});
|
|
35
|
-
if (!result) return [`${(0,
|
|
35
|
+
if (!result) return [`${(0, __shell_shock_core_plugin_utils.getAppTitle)(context, true)} Command-Line Interface`];
|
|
36
36
|
return result.array;
|
|
37
37
|
});
|
|
38
38
|
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);
|
|
@@ -41,7 +41,7 @@ function BannerFunctionDeclaration(props) {
|
|
|
41
41
|
async: true,
|
|
42
42
|
name: "banner",
|
|
43
43
|
get doc() {
|
|
44
|
-
return `Write the ${(0,
|
|
44
|
+
return `Write the ${(0, __shell_shock_core_plugin_utils.getAppTitle)(context, true)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
|
|
45
45
|
},
|
|
46
46
|
get parameters() {
|
|
47
47
|
return [{
|
|
@@ -108,7 +108,7 @@ function BannerFunctionDeclaration(props) {
|
|
|
108
108
|
},
|
|
109
109
|
get fallback() {
|
|
110
110
|
return [(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`spinner.stop();
|
|
111
|
-
info(\`A new version of ${(0,
|
|
111
|
+
info(\`A new version of ${(0, __shell_shock_core_plugin_utils.getAppTitle)(context, true)} is available: \${colors.red(\`v\${result.currentVersion}\`)} \${colors.text.body.tertiary("➜")} \${colors.green(\`v\${result.latestVersion}\`)}\${result.package.date ? colors.text.body.tertiary(\` (updated on \${result.package.date})\`) : ""}\`);
|
|
112
112
|
|
|
113
113
|
try {
|
|
114
114
|
await upgrade();
|
|
@@ -120,14 +120,14 @@ function BannerFunctionDeclaration(props) {
|
|
|
120
120
|
await waitForKeyPress();
|
|
121
121
|
return;
|
|
122
122
|
} catch (err) {
|
|
123
|
-
spinner.error(\`An error occurred while updating ${(0,
|
|
123
|
+
spinner.error(\`An error occurred while updating ${(0, __shell_shock_core_plugin_utils.getAppTitle)(context, true)} to v\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\`);
|
|
124
124
|
debug(err);
|
|
125
125
|
} `), (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {})];
|
|
126
126
|
},
|
|
127
127
|
get children() {
|
|
128
128
|
return [
|
|
129
129
|
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`spinner.stop();
|
|
130
|
-
warn(\`A new version of ${(0,
|
|
130
|
+
warn(\`A new version of ${(0, __shell_shock_core_plugin_utils.getAppTitle)(context, true)} is available: \${colors.red(\`v\${result.currentVersion}\`)} \${colors.text.body.tertiary("➜")} \${colors.green(\`v\${result.latestVersion}\`)}\${result.package.date ? colors.text.body.tertiary(\` (updated on \${result.package.date})\`) : ""}${context.config.upgrade !== false && context.config.upgrade.type === "manual" ? ` \\nPlease run \`${(0, __shell_shock_core_plugin_utils.getAppBin)(context)} update\` to upgrade to the latest version.` : ""}\`); `),
|
|
131
131
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
132
132
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
133
133
|
get when() {
|
|
@@ -143,7 +143,7 @@ function BannerFunctionDeclaration(props) {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
if (willUpgradeNow) {
|
|
146
|
-
spinner.text = \`Updating ${(0,
|
|
146
|
+
spinner.text = \`Updating ${(0, __shell_shock_core_plugin_utils.getAppTitle)(context, true)} to v\${result.latestVersion}...\`;
|
|
147
147
|
spinner.start();
|
|
148
148
|
|
|
149
149
|
try {
|
|
@@ -156,11 +156,11 @@ function BannerFunctionDeclaration(props) {
|
|
|
156
156
|
await waitForKeyPress();
|
|
157
157
|
return;
|
|
158
158
|
} catch (err) {
|
|
159
|
-
spinner.error(\`An error occurred while updating ${(0,
|
|
159
|
+
spinner.error(\`An error occurred while updating ${(0, __shell_shock_core_plugin_utils.getAppTitle)(context, true)} to v\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\`);
|
|
160
160
|
return { error: err };
|
|
161
161
|
}
|
|
162
162
|
} else {
|
|
163
|
-
help("Updates can be performed at any time by running the \`${(0,
|
|
163
|
+
help("Updates can be performed at any time by running the \`${(0, __shell_shock_core_plugin_utils.getAppBin)(context)} update\` command. Please remember that keeping your application up to date is important for ensuring you have the latest features, performance improvements, and security patches.");
|
|
164
164
|
} `;
|
|
165
165
|
}
|
|
166
166
|
})
|
|
@@ -172,12 +172,12 @@ function BannerFunctionDeclaration(props) {
|
|
|
172
172
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
173
173
|
condition: __alloy_js_core.code`result.isError`,
|
|
174
174
|
get children() {
|
|
175
|
-
return __alloy_js_core.code`spinner.error(\`An error occurred while checking for ${(0,
|
|
175
|
+
return __alloy_js_core.code`spinner.error(\`An error occurred while checking for ${(0, __shell_shock_core_plugin_utils.getAppTitle)(context, true)} application updates. Please try again later - if the problem persists, please contact support.\`);
|
|
176
176
|
debug(result.error); `;
|
|
177
177
|
}
|
|
178
178
|
}),
|
|
179
179
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseClause, { get children() {
|
|
180
|
-
return __alloy_js_core.code`spinner.success("Currently running the latest version of ${(0,
|
|
180
|
+
return __alloy_js_core.code`spinner.success("Currently running the latest version of ${(0, __shell_shock_core_plugin_utils.getAppTitle)(context, true)}.");
|
|
181
181
|
writeLine("");
|
|
182
182
|
`;
|
|
183
183
|
} })
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core1 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_core1.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_core2 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_core2.Children;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { BannerFunctionDeclaration };
|
|
11
11
|
//# sourceMappingURL=banner-function-declaration.d.mts.map
|
|
@@ -3,7 +3,7 @@ import { Show, code, computed } from "@alloy-js/core";
|
|
|
3
3
|
import { ElseClause, ElseIfClause, FunctionDeclaration, IfStatement, VarDeclaration } from "@alloy-js/typescript";
|
|
4
4
|
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
5
5
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
6
|
-
import { getAppBin, getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils
|
|
6
|
+
import { getAppBin, getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
7
7
|
import { useTheme } from "@shell-shock/plugin-theme/contexts/theme";
|
|
8
8
|
import { BannerFunctionBodyDeclaration } from "@shell-shock/preset-script/components/banner-function-declaration";
|
|
9
9
|
import { render } from "cfonts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","Show","ElseClause","ElseIfClause","FunctionDeclaration","IfStatement","VarDeclaration","Spacing","usePowerlines","getAppBin","getAppDescription","getAppTitle","useTheme","BannerFunctionBodyDeclaration","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","config","upgrade","children","insertNewlineAfterDescription","map","line","JSON","stringify","trim","join","condition","when","initializer","fallback","_$memo"],"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, Show } from \"@alloy-js/core\";\nimport {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppBin,\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport type { BannerFunctionDeclarationProps } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { BannerFunctionBodyDeclaration } from \"@shell-shock/preset-script/components/banner-function-declaration\";\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${\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={[\n { name: \"pause\", type: \"number\", default: 500 },\n {\n name: \"upgradeCheck\",\n default: context.config.upgrade !== false ? \"true\" : \"false\"\n }\n ]}>\n <BannerFunctionBodyDeclaration\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}\n insertNewlineAfterDescription>\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 <Show when={context.config.upgrade !== false}>\n <IfStatement\n condition={code`upgradeCheck && (await isCheckForUpdatesRequired())`}>\n <VarDeclaration\n const\n name=\"spinner\"\n initializer={code`createSpinner({\n message: \"Checking for updates...\"\n }).start(); `}\n />\n <VarDeclaration\n const\n name=\"result\"\n initializer={code`await checkForUpdates({ force: true }); `}\n />\n <IfStatement condition={code`!result.isUpToDate`}>\n <Show\n when={\n context.config.upgrade !== false &&\n (context.config.upgrade.type === \"confirm\" ||\n context.config.upgrade.type === \"manual\")\n }\n fallback={\n <>\n {code`spinner.stop();\n info(\\`A new version of ${getAppTitle(\n context,\n true\n )} is available: \\${colors.red(\\`v\\${result.currentVersion}\\`)} \\${colors.text.body.tertiary(\"➜\")} \\${colors.green(\\`v\\${result.latestVersion}\\`)}\\${result.package.date ? colors.text.body.tertiary(\\` (updated on \\${result.package.date})\\`) : \"\"}\\`);\n\n try {\n await upgrade();\n spinner.success(\"Update successful! Please restart the application to apply the update.\");\n\n writeLine(\"\");\n writeLine(\"Press any key to exit application...\");\n\n await waitForKeyPress();\n return;\n } catch (err) {\n spinner.error(\\`An error occurred while updating ${getAppTitle(\n context,\n true\n )} to v\\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\\`);\n debug(err);\n } `}\n <Spacing />\n </>\n }>\n {code`spinner.stop();\n warn(\\`A new version of ${getAppTitle(\n context,\n true\n )} is available: \\${colors.red(\\`v\\${result.currentVersion}\\`)} \\${colors.text.body.tertiary(\"➜\")} \\${colors.green(\\`v\\${result.latestVersion}\\`)}\\${result.package.date ? colors.text.body.tertiary(\\` (updated on \\${result.package.date})\\`) : \"\"}${\n context.config.upgrade !== false &&\n context.config.upgrade.type === \"manual\"\n ? ` \\\\nPlease run \\`${getAppBin(\n context\n )} update\\` to upgrade to the latest version.`\n : \"\"\n }\\`); `}\n <Spacing />\n <Show\n when={\n context.config.upgrade !== false &&\n context.config.upgrade.type === \"confirm\"\n }>\n {code`const willUpgradeNow = await confirm({\n message: \\`Would you like to update to v\\${result.latestVersion} now?\\`,\n initialValue: true\n });\n if (isCancel(willUpgradeNow)) {\n return;\n }\n\n if (willUpgradeNow) {\n spinner.text = \\`Updating ${getAppTitle(\n context,\n true\n )} to v\\${result.latestVersion}...\\`;\n spinner.start();\n\n try {\n await upgrade();\n spinner.success(\"Update successful! Please restart the application to apply the update.\");\n\n writeLine(\"\");\n writeLine(\"Press any key to exit application...\");\n\n await waitForKeyPress();\n return;\n } catch (err) {\n spinner.error(\\`An error occurred while updating ${getAppTitle(\n context,\n true\n )} to v\\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\\`);\n return { error: err };\n }\n } else {\n help(\"Updates can be performed at any time by running the \\`${getAppBin(\n context\n )} update\\` command. Please remember that keeping your application up to date is important for ensuring you have the latest features, performance improvements, and security patches.\");\n } `}\n </Show>\n </Show>\n </IfStatement>\n <ElseIfClause condition={code`result.isError`}>\n {code`spinner.error(\\`An error occurred while checking for ${getAppTitle(\n context,\n true\n )} application updates. Please try again later - if the problem persists, please contact support.\\`);\n debug(result.error); `}\n </ElseIfClause>\n <ElseClause>{code`spinner.success(\"Currently running the latest version of ${getAppTitle(\n context,\n true\n )}.\");\n writeLine(\"\");\n `}</ElseClause>\n </IfStatement>\n </Show>\n </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA0CA,SAAgBgB,0BACdC,OACA;CACA,MAAM,EAAEC,gBAAgB,OAAOC,UAAU,WAAWC,YAAYH;CAEhE,MAAMI,QAAQR,UAAU;CAExB,MAAMS,UAAUb,eAAiC;CAEj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YACxBU,SACA,KACD,CAAA;;;;;;;;;;;;yEAYoDV,YACjDU,SACA,KACD,CAAA;;wBAEA,EAAAiC,gBACF/C,SAAO,EAAA,CAAA,CAAA;;YAAA,IAAAwD,WAAA;AAAA,oBAAA;cAAAY,WAGX5E,IAAI;0CACqBY,YACxBU,SACA,KACD,CAAA,qPACCA,QAAQwC,OAAOC,YAAY,SAC3BzC,QAAQwC,OAAOC,QAAQH,SAAS,WAC5B,oBAAoBlD,UAClBY,QACD,CAAA,+CACD,GAAE,OACD;cAAAiC,gBACN/C,SAAO,EAAA,CAAA;cAAA+C,gBACPrD,MAAI;eAAA,IACHuE,OAAI;AAAA,uBACFnD,QAAQwC,OAAOC,YAAY,SAC3BzC,QAAQwC,OAAOC,QAAQH,SAAS;;eAAS,IAAAI,WAAA;AAAA,uBAE1ChE,IAAI;;;;;;;;;8CASuBY,YAC1BU,SACA,KACD,CAAA;;;;;;;;;;;;;uEAaoDV,YACjDU,SACA,KACD,CAAA;;;;gFAI2DZ,UAC5DY,QACD,CAAA;;;eACA,CAAA;cAAA;;YAAA,CAAA;;UAAA,CAAA;SAAAiC,gBAINnD,cAAY;UAACoE,WAAWxE,IAAI;UAAgB,IAAAgE,WAAA;AAAA,kBAC1ChE,IAAI,wDAAwDY,YAC3DU,SACA,KACD,CAAA;;;UACqB,CAAA;SAAAiC,gBAEvBpD,YAAU,EAAA,IAAA6D,WAAA;AAAA,iBAAEhE,IAAI,4DAA4DY,YAC3EU,SACA,KACD,CAAA;;;YAEA,CAAA;SAAA;;OAAA,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","Show","ElseClause","ElseIfClause","FunctionDeclaration","IfStatement","VarDeclaration","Spacing","usePowerlines","getAppBin","getAppDescription","getAppTitle","useTheme","BannerFunctionBodyDeclaration","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","config","upgrade","children","insertNewlineAfterDescription","map","line","JSON","stringify","trim","join","condition","when","initializer","fallback","_$memo"],"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, Show } from \"@alloy-js/core\";\nimport {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppBin,\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport type { BannerFunctionDeclarationProps } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { BannerFunctionBodyDeclaration } from \"@shell-shock/preset-script/components/banner-function-declaration\";\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${\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={[\n { name: \"pause\", type: \"number\", default: 500 },\n {\n name: \"upgradeCheck\",\n default: context.config.upgrade !== false ? \"true\" : \"false\"\n }\n ]}>\n <BannerFunctionBodyDeclaration\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}\n insertNewlineAfterDescription>\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 <Show when={context.config.upgrade !== false}>\n <IfStatement\n condition={code`upgradeCheck && (await isCheckForUpdatesRequired())`}>\n <VarDeclaration\n const\n name=\"spinner\"\n initializer={code`createSpinner({\n message: \"Checking for updates...\"\n }).start(); `}\n />\n <VarDeclaration\n const\n name=\"result\"\n initializer={code`await checkForUpdates({ force: true }); `}\n />\n <IfStatement condition={code`!result.isUpToDate`}>\n <Show\n when={\n context.config.upgrade !== false &&\n (context.config.upgrade.type === \"confirm\" ||\n context.config.upgrade.type === \"manual\")\n }\n fallback={\n <>\n {code`spinner.stop();\n info(\\`A new version of ${getAppTitle(\n context,\n true\n )} is available: \\${colors.red(\\`v\\${result.currentVersion}\\`)} \\${colors.text.body.tertiary(\"➜\")} \\${colors.green(\\`v\\${result.latestVersion}\\`)}\\${result.package.date ? colors.text.body.tertiary(\\` (updated on \\${result.package.date})\\`) : \"\"}\\`);\n\n try {\n await upgrade();\n spinner.success(\"Update successful! Please restart the application to apply the update.\");\n\n writeLine(\"\");\n writeLine(\"Press any key to exit application...\");\n\n await waitForKeyPress();\n return;\n } catch (err) {\n spinner.error(\\`An error occurred while updating ${getAppTitle(\n context,\n true\n )} to v\\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\\`);\n debug(err);\n } `}\n <Spacing />\n </>\n }>\n {code`spinner.stop();\n warn(\\`A new version of ${getAppTitle(\n context,\n true\n )} is available: \\${colors.red(\\`v\\${result.currentVersion}\\`)} \\${colors.text.body.tertiary(\"➜\")} \\${colors.green(\\`v\\${result.latestVersion}\\`)}\\${result.package.date ? colors.text.body.tertiary(\\` (updated on \\${result.package.date})\\`) : \"\"}${\n context.config.upgrade !== false &&\n context.config.upgrade.type === \"manual\"\n ? ` \\\\nPlease run \\`${getAppBin(\n context\n )} update\\` to upgrade to the latest version.`\n : \"\"\n }\\`); `}\n <Spacing />\n <Show\n when={\n context.config.upgrade !== false &&\n context.config.upgrade.type === \"confirm\"\n }>\n {code`const willUpgradeNow = await confirm({\n message: \\`Would you like to update to v\\${result.latestVersion} now?\\`,\n initialValue: true\n });\n if (isCancel(willUpgradeNow)) {\n return;\n }\n\n if (willUpgradeNow) {\n spinner.text = \\`Updating ${getAppTitle(\n context,\n true\n )} to v\\${result.latestVersion}...\\`;\n spinner.start();\n\n try {\n await upgrade();\n spinner.success(\"Update successful! Please restart the application to apply the update.\");\n\n writeLine(\"\");\n writeLine(\"Press any key to exit application...\");\n\n await waitForKeyPress();\n return;\n } catch (err) {\n spinner.error(\\`An error occurred while updating ${getAppTitle(\n context,\n true\n )} to v\\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\\`);\n return { error: err };\n }\n } else {\n help(\"Updates can be performed at any time by running the \\`${getAppBin(\n context\n )} update\\` command. Please remember that keeping your application up to date is important for ensuring you have the latest features, performance improvements, and security patches.\");\n } `}\n </Show>\n </Show>\n </IfStatement>\n <ElseIfClause condition={code`result.isError`}>\n {code`spinner.error(\\`An error occurred while checking for ${getAppTitle(\n context,\n true\n )} application updates. Please try again later - if the problem persists, please contact support.\\`);\n debug(result.error); `}\n </ElseIfClause>\n <ElseClause>{code`spinner.success(\"Currently running the latest version of ${getAppTitle(\n context,\n true\n )}.\");\n writeLine(\"\");\n `}</ElseClause>\n </IfStatement>\n </Show>\n </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA0CA,SAAgBgB,0BACdC,OACA;CACA,MAAM,EAAEC,gBAAgB,OAAOC,UAAU,WAAWC,YAAYH;CAEhE,MAAMI,QAAQR,UAAU;CAExB,MAAMS,UAAUb,eAAiC;CAEjD,MAAMc,SAAStB,eAEX,GAAGoB,MAAMG,OAAOC,OAAOF,OAAOJ,YAAYP,YAAYU,QAAQ,CAAA,IAC5DA,QAAQI,YAAYC,WAAW,UAEpC;CACD,MAAMC,SAAS3B,eAAeoB,MAAMG,OAAOC,OAAOG,OAAOT,SAAS;CAClE,MAAMU,QAAQ5B,eACZW,YAAYU,SAAS,KAAK,CAACQ,QACzB,IAAIR,QAAQI,YAAYC,WAAW,WACnC,GAEJ,CAAC;CACD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D,CAAA,+CACD,GAAE,OACD;cAAAiC,gBACN/C,SAAO,EAAA,CAAA;cAAA+C,gBACPrD,MAAI;eAAA,IACHuE,OAAI;AAAA,uBACFnD,QAAQwC,OAAOC,YAAY,SAC3BzC,QAAQwC,OAAOC,QAAQH,SAAS;;eAAS,IAAAI,WAAA;AAAA,uBAE1ChE,IAAI;;;;;;;;;8CASuBY,YAC1BU,SACA,KACD,CAAA;;;;;;;;;;;;;uEAaoDV,YACjDU,SACA,KACD,CAAA;;;;gFAI2DZ,UAC5DY,QACD,CAAA;;;eACA,CAAA;cAAA;;YAAA,CAAA;;UAAA,CAAA;SAAAiC,gBAINnD,cAAY;UAACoE,WAAWxE,IAAI;UAAgB,IAAAgE,WAAA;AAAA,kBAC1ChE,IAAI,wDAAwDY,YAC3DU,SACA,KACD,CAAA;;;UACqB,CAAA;SAAAiC,gBAEvBpD,YAAU,EAAA,IAAA6D,WAAA;AAAA,iBAAEhE,IAAI,4DAA4DY,YAC3EU,SACA,KACD,CAAA;;;YAEA,CAAA;SAAA;;OAAA,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA"}
|
|
@@ -6,9 +6,9 @@ let __alloy_js_core = require("@alloy-js/core");
|
|
|
6
6
|
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
7
7
|
let __powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
8
|
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
9
|
-
let
|
|
10
|
-
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
9
|
+
let __shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
11
10
|
let __powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
11
|
+
let __shell_shock_core = require("@shell-shock/core");
|
|
12
12
|
let __shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
|
|
13
13
|
let __stryke_path_find = require("@stryke/path/find");
|
|
14
14
|
let __stryke_path_join = require("@stryke/path/join");
|
|
@@ -25,8 +25,8 @@ defu = require_rolldown_runtime.__toESM(defu);
|
|
|
25
25
|
function CommandEntry(props) {
|
|
26
26
|
const { command, imports, builtinImports, ...rest } = props;
|
|
27
27
|
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
28
|
-
const filePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_join.joinPaths)(command.segments.filter((segment) => !(0,
|
|
29
|
-
const commandSourcePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_replace.replaceExtension)((0, __stryke_path_find.relativePath)((0, __stryke_path_join.joinPaths)(context.entryPath, (0, __stryke_path_find.findFilePath)(filePath.value)), command.entry.input?.file || command.entry.file)));
|
|
28
|
+
const filePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_join.joinPaths)(command.segments.filter((segment) => !(0, __shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)).join("/"), "index.ts"));
|
|
29
|
+
const commandSourcePath = (0, __alloy_js_core.computed)(() => `./${(0, __stryke_path_replace.replaceExtension)((0, __stryke_path_find.relativePath)((0, __stryke_path_join.joinPaths)(context.entryPath, (0, __stryke_path_find.findFilePath)(filePath.value)), command.entry.input?.file || command.entry.file))}`);
|
|
30
30
|
const typeDefinition = (0, __alloy_js_core.computed)(() => ({
|
|
31
31
|
...command.entry,
|
|
32
32
|
output: command.id
|
|
@@ -109,12 +109,12 @@ function CommandEntry(props) {
|
|
|
109
109
|
}
|
|
110
110
|
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
111
111
|
get when() {
|
|
112
|
-
return Object.values(command.options ?? {}).filter((option) => !option.optional).length > 0 || Object.values(command.
|
|
112
|
+
return Object.values(command.options ?? {}).filter((option) => !option.optional).length > 0 || Object.values(command.args ?? {}).filter((arg) => !arg.optional).length > 0;
|
|
113
113
|
},
|
|
114
114
|
get children() {
|
|
115
115
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
116
116
|
get condition() {
|
|
117
|
-
return __alloy_js_core.code`!isHelp && (${Object.values(command.options ?? {}).filter((option) => !option.optional).map((option) => (option.kind ===
|
|
117
|
+
return __alloy_js_core.code`!isHelp && (${Object.values(command.options ?? {}).filter((option) => !option.optional).map((option) => (option.kind === __shell_shock_core.CommandParameterKinds.string || option.kind === __shell_shock_core.CommandParameterKinds.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.args ?? {}).filter((arg) => !arg.optional).length > 0 ? " || " : ""}${Object.values(command.args ?? {}).filter((arg) => !arg.optional).map((arg) => (arg.kind === __shell_shock_core.CommandParameterKinds.string || arg.kind === __shell_shock_core.CommandParameterKinds.number) && arg.variadic ? `(!${(0, __stryke_string_format_camel_case.camelCase)(arg.name)} || ${(0, __stryke_string_format_camel_case.camelCase)(arg.name)}.length === 0)` : `${(0, __stryke_string_format_camel_case.camelCase)(arg.name)} === undefined`).join(" || ")}) `;
|
|
118
118
|
},
|
|
119
119
|
get children() {
|
|
120
120
|
return [
|
|
@@ -135,17 +135,34 @@ function CommandEntry(props) {
|
|
|
135
135
|
return __alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}`;
|
|
136
136
|
},
|
|
137
137
|
get children() {
|
|
138
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
138
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
139
|
+
get when() {
|
|
140
|
+
return option.kind === __shell_shock_core.CommandParameterKinds.boolean || !option.choices || option.choices.length === 0;
|
|
141
|
+
},
|
|
142
|
+
get fallback() {
|
|
143
|
+
return __alloy_js_core.code`const value = await select({
|
|
144
|
+
message: \`Please select a value for the \${colors.italic("${option.name}")} option\`, ${option.description ? `description: \`${(0, __shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
145
|
+
` : ""}options: [ ${option.choices?.map((choice) => `{ value: ${JSON.stringify(choice)}, label: "${choice}", ${option.description ? `description: \`${(0, __shell_shock_core_plugin_utils.formatShortDescription)(option.description)}\`` : ""} }`).join(", ")} ]
|
|
146
|
+
});
|
|
147
|
+
if (isCancel(value)) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
152
|
+
`;
|
|
153
|
+
},
|
|
154
|
+
get children() {
|
|
155
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Switch, { get children() {
|
|
156
|
+
return [
|
|
157
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
158
|
+
get when() {
|
|
159
|
+
return option.kind === __shell_shock_core.CommandParameterKinds.string;
|
|
160
|
+
},
|
|
161
|
+
get children() {
|
|
162
|
+
return __alloy_js_core.code`
|
|
146
163
|
const value = await text({
|
|
147
164
|
message: \`Please provide a value for the \${colors.italic("${option.name}")} option\`,
|
|
148
|
-
${option.description ? `description:
|
|
165
|
+
${option.description ? `description: \`${(0, __shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
149
166
|
` : ""}validate(val) {
|
|
150
167
|
if (!val || val.trim() === "") {
|
|
151
168
|
return "A value must be provided for this option";
|
|
@@ -160,17 +177,17 @@ function CommandEntry(props) {
|
|
|
160
177
|
|
|
161
178
|
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
162
179
|
`;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
180
|
+
}
|
|
181
|
+
}),
|
|
182
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
183
|
+
get when() {
|
|
184
|
+
return option.kind === __shell_shock_core.CommandParameterKinds.number;
|
|
185
|
+
},
|
|
186
|
+
get children() {
|
|
187
|
+
return __alloy_js_core.code`
|
|
171
188
|
const value = await numeric({
|
|
172
189
|
message: \`Please provide a numeric value for the \${colors.italic("${option.name}")} option\`,
|
|
173
|
-
${option.description ? `description:
|
|
190
|
+
${option.description ? `description: \`${(0, __shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
174
191
|
` : ""}
|
|
175
192
|
});
|
|
176
193
|
if (isCancel(value)) {
|
|
@@ -179,17 +196,17 @@ function CommandEntry(props) {
|
|
|
179
196
|
|
|
180
197
|
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
181
198
|
`;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
199
|
+
}
|
|
200
|
+
}),
|
|
201
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
202
|
+
get when() {
|
|
203
|
+
return option.kind === __shell_shock_core.CommandParameterKinds.boolean;
|
|
204
|
+
},
|
|
205
|
+
get children() {
|
|
206
|
+
return __alloy_js_core.code`
|
|
190
207
|
const value = await toggle({
|
|
191
208
|
message: \`Please select a value for the \${colors.italic("${option.name}")} option\`,
|
|
192
|
-
${option.description ? `description:
|
|
209
|
+
${option.description ? `description: \`${(0, __shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
193
210
|
` : ""}
|
|
194
211
|
});
|
|
195
212
|
if (isCancel(value)) {
|
|
@@ -198,14 +215,16 @@ function CommandEntry(props) {
|
|
|
198
215
|
|
|
199
216
|
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
200
217
|
`;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
];
|
|
221
|
+
} });
|
|
222
|
+
}
|
|
223
|
+
});
|
|
205
224
|
}
|
|
206
225
|
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
207
226
|
get when() {
|
|
208
|
-
return (option.kind ===
|
|
227
|
+
return (option.kind === __shell_shock_core.CommandParameterKinds.string || option.kind === __shell_shock_core.CommandParameterKinds.number) && option.variadic;
|
|
209
228
|
},
|
|
210
229
|
get children() {
|
|
211
230
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
@@ -215,8 +234,8 @@ function CommandEntry(props) {
|
|
|
215
234
|
get children() {
|
|
216
235
|
return __alloy_js_core.code`
|
|
217
236
|
const value = await text({
|
|
218
|
-
message: \`Please provide one or more${option.kind ===
|
|
219
|
-
${option.description ? `description:
|
|
237
|
+
message: \`Please provide one or more${option.kind === __shell_shock_core.CommandParameterKinds.number ? " numeric" : ""} values for the \${colors.italic("${option.name}")} option (values are separated by a \\",\\" character)\`,
|
|
238
|
+
${option.description ? `description: \`${(0, __shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
220
239
|
` : ""}validate(val) {
|
|
221
240
|
if (!val || val.trim() === "") {
|
|
222
241
|
return "A value must be provided for this option";
|
|
@@ -224,7 +243,7 @@ function CommandEntry(props) {
|
|
|
224
243
|
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
225
244
|
return "At least one value must be provided for this option";
|
|
226
245
|
}
|
|
227
|
-
${option.kind ===
|
|
246
|
+
${option.kind === __shell_shock_core.CommandParameterKinds.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
|
|
228
247
|
if (invalidIndex !== -1) {
|
|
229
248
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
230
249
|
} ` : ""}
|
|
@@ -235,7 +254,7 @@ function CommandEntry(props) {
|
|
|
235
254
|
return;
|
|
236
255
|
}
|
|
237
256
|
|
|
238
|
-
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 ===
|
|
257
|
+
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 === __shell_shock_core.CommandParameterKinds.number ? `.map(Number)` : ""} ;
|
|
239
258
|
`;
|
|
240
259
|
}
|
|
241
260
|
});
|
|
@@ -247,30 +266,48 @@ function CommandEntry(props) {
|
|
|
247
266
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
248
267
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
249
268
|
get each() {
|
|
250
|
-
return command.
|
|
269
|
+
return command.args;
|
|
251
270
|
},
|
|
252
271
|
doubleHardline: true,
|
|
253
|
-
children: (
|
|
272
|
+
children: (arg) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
254
273
|
get when() {
|
|
255
|
-
return !
|
|
274
|
+
return !arg.optional;
|
|
256
275
|
},
|
|
257
276
|
get children() {
|
|
258
277
|
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
259
278
|
get condition() {
|
|
260
|
-
return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)(
|
|
279
|
+
return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)(arg.name)}`;
|
|
261
280
|
},
|
|
262
281
|
get children() {
|
|
263
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
282
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
283
|
+
get when() {
|
|
284
|
+
return arg.kind === __shell_shock_core.CommandParameterKinds.boolean || !arg.choices || arg.choices.length === 0;
|
|
285
|
+
},
|
|
286
|
+
get fallback() {
|
|
287
|
+
return __alloy_js_core.code`const value = await select({
|
|
288
|
+
message: \`Please select a value for the \${colors.italic("${arg.name}")} argument\`,${arg.description ? `description: \`${(0, __shell_shock_core_plugin_utils.formatDescription)(arg.description)}\`,
|
|
289
|
+
` : ""}
|
|
290
|
+
options: [ ${arg.choices?.map((choice) => `{ value: ${JSON.stringify(choice)}, label: "${choice}", ${arg.description ? `description: \`${(0, __shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`` : ""} }`).join(", ")} ]
|
|
291
|
+
});
|
|
292
|
+
if (isCancel(value)) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
${(0, __stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
297
|
+
`;
|
|
298
|
+
},
|
|
299
|
+
get children() {
|
|
300
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Switch, { get children() {
|
|
301
|
+
return [
|
|
302
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
303
|
+
get when() {
|
|
304
|
+
return arg.kind === __shell_shock_core.CommandParameterKinds.string;
|
|
305
|
+
},
|
|
306
|
+
get children() {
|
|
307
|
+
return __alloy_js_core.code`
|
|
271
308
|
const value = await text({
|
|
272
|
-
message: \`Please provide a value for the \${colors.italic("${
|
|
273
|
-
${
|
|
309
|
+
message: \`Please provide a value for the \${colors.italic("${arg.name}")} argument\`,
|
|
310
|
+
${arg.description ? `description: \`${(0, __shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
274
311
|
` : ""}validate(val) {
|
|
275
312
|
if (!val || val.trim() === "") {
|
|
276
313
|
return "A value must be provided for this argument";
|
|
@@ -283,65 +320,67 @@ function CommandEntry(props) {
|
|
|
283
320
|
return;
|
|
284
321
|
}
|
|
285
322
|
|
|
286
|
-
${(0, __stryke_string_format_camel_case.camelCase)(
|
|
323
|
+
${(0, __stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
287
324
|
`;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
325
|
+
}
|
|
326
|
+
}),
|
|
327
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
328
|
+
get when() {
|
|
329
|
+
return arg.kind === __shell_shock_core.CommandParameterKinds.number;
|
|
330
|
+
},
|
|
331
|
+
get children() {
|
|
332
|
+
return __alloy_js_core.code`
|
|
296
333
|
const value = await numeric({
|
|
297
|
-
message: \`Please provide a numeric value for the \${colors.italic("${
|
|
298
|
-
${
|
|
334
|
+
message: \`Please provide a numeric value for the \${colors.italic("${arg.name}")} argument\`,
|
|
335
|
+
${arg.description ? `description: \`${(0, __shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
299
336
|
` : ""}
|
|
300
337
|
});
|
|
301
338
|
if (isCancel(value)) {
|
|
302
339
|
return;
|
|
303
340
|
}
|
|
304
341
|
|
|
305
|
-
${(0, __stryke_string_format_camel_case.camelCase)(
|
|
342
|
+
${(0, __stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
306
343
|
`;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
344
|
+
}
|
|
345
|
+
}),
|
|
346
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Match, {
|
|
347
|
+
get when() {
|
|
348
|
+
return arg.kind === __shell_shock_core.CommandParameterKinds.boolean;
|
|
349
|
+
},
|
|
350
|
+
get children() {
|
|
351
|
+
return __alloy_js_core.code`
|
|
315
352
|
const value = await toggle({
|
|
316
|
-
message: \`Please select a value for the \${colors.italic("${
|
|
317
|
-
${
|
|
353
|
+
message: \`Please select a value for the \${colors.italic("${arg.name}")} argument\`,
|
|
354
|
+
${arg.description ? `description: \`${(0, __shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
318
355
|
` : ""}
|
|
319
356
|
});
|
|
320
357
|
if (isCancel(value)) {
|
|
321
358
|
return;
|
|
322
359
|
}
|
|
323
360
|
|
|
324
|
-
${(0, __stryke_string_format_camel_case.camelCase)(
|
|
361
|
+
${(0, __stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
325
362
|
`;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
363
|
+
}
|
|
364
|
+
})
|
|
365
|
+
];
|
|
366
|
+
} });
|
|
367
|
+
}
|
|
368
|
+
});
|
|
330
369
|
}
|
|
331
370
|
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
332
371
|
get when() {
|
|
333
|
-
return (
|
|
372
|
+
return (arg.kind === __shell_shock_core.CommandParameterKinds.string || arg.kind === __shell_shock_core.CommandParameterKinds.number) && arg.variadic;
|
|
334
373
|
},
|
|
335
374
|
get children() {
|
|
336
375
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
337
376
|
get condition() {
|
|
338
|
-
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(
|
|
377
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(arg.name)}.length === 0`;
|
|
339
378
|
},
|
|
340
379
|
get children() {
|
|
341
380
|
return __alloy_js_core.code`
|
|
342
381
|
const value = await text({
|
|
343
|
-
message: \`Please provide one or more${
|
|
344
|
-
${
|
|
382
|
+
message: \`Please provide one or more${arg.kind === __shell_shock_core.CommandParameterKinds.number ? " numeric" : ""} values for the \${colors.italic("${arg.name}")} argument (values are separated by a \\",\\" character)\`,
|
|
383
|
+
${arg.description ? `description: \`${(0, __shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
345
384
|
` : ""}validate(val) {
|
|
346
385
|
if (!val || val.trim() === "") {
|
|
347
386
|
return "A value must be provided for this argument";
|
|
@@ -349,7 +388,7 @@ function CommandEntry(props) {
|
|
|
349
388
|
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
350
389
|
return "At least one value must be provided for this argument";
|
|
351
390
|
}
|
|
352
|
-
${
|
|
391
|
+
${arg.kind === __shell_shock_core.CommandParameterKinds.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
|
|
353
392
|
if (invalidIndex !== -1) {
|
|
354
393
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
355
394
|
} ` : ""}
|
|
@@ -361,7 +400,7 @@ function CommandEntry(props) {
|
|
|
361
400
|
return;
|
|
362
401
|
}
|
|
363
402
|
|
|
364
|
-
${(0, __stryke_string_format_camel_case.camelCase)(
|
|
403
|
+
${(0, __stryke_string_format_camel_case.camelCase)(arg.name)} = value.split(",").map(value => value.trim()).filter(Boolean)${arg.kind === __shell_shock_core.CommandParameterKinds.number ? `.map(Number)` : ""} ;
|
|
365
404
|
`;
|
|
366
405
|
}
|
|
367
406
|
});
|