@shell-shock/preset-cli 0.8.0 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
- package/dist/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/components/banner-function-declaration.cjs +48 -164
- package/dist/components/banner-function-declaration.d.cts +2 -2
- package/dist/components/banner-function-declaration.d.cts.map +1 -1
- package/dist/components/banner-function-declaration.d.mts +2 -2
- package/dist/components/banner-function-declaration.d.mts.map +1 -1
- package/dist/components/banner-function-declaration.mjs +29 -146
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/command-entry.cjs +122 -120
- 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 +21 -20
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +20 -19
- package/dist/components/command-router.d.cts +3 -3
- 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 +1 -1
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/index.cjs +4 -0
- package/dist/components/index.d.cts +2 -1
- package/dist/components/index.d.mts +2 -1
- package/dist/components/index.mjs +2 -1
- package/dist/components/upgrade-builtin.cjs +171 -0
- package/dist/components/upgrade-builtin.d.cts +15 -0
- package/dist/components/upgrade-builtin.d.cts.map +1 -0
- package/dist/components/upgrade-builtin.d.mts +15 -0
- package/dist/components/upgrade-builtin.d.mts.map +1 -0
- package/dist/components/upgrade-builtin.mjs +169 -0
- package/dist/components/upgrade-builtin.mjs.map +1 -0
- package/dist/components/virtual-command-entry.cjs +26 -24
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts +3 -3
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +7 -6
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +6 -6
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +49 -62
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +23 -36
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-help/dist/components/display.cjs +259 -0
- package/dist/plugin-help/dist/components/display.mjs +254 -0
- package/dist/plugin-help/dist/components/display.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-builtin.cjs +85 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs +84 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-command.cjs +96 -0
- package/dist/plugin-help/dist/components/help-command.mjs +96 -0
- package/dist/plugin-help/dist/components/help-command.mjs.map +1 -0
- package/dist/plugin-help/dist/components/index.cjs +3 -0
- package/dist/plugin-help/dist/components/index.mjs +5 -0
- package/dist/plugin-help/dist/index.cjs +103 -0
- package/dist/plugin-help/dist/index.d.cts +2 -0
- package/dist/plugin-help/dist/index.d.mts +2 -0
- package/dist/plugin-help/dist/index.mjs +100 -0
- package/dist/plugin-help/dist/index.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.cjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.cjs +38 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs +38 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs +33 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs +34 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs +40 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs +41 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.cjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.cjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.cjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.cjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.cjs +19 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.cjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.cjs +8 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs +8 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.cts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.cts.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.mts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/plugin.d.cts +20 -34
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +20 -34
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +30 -16
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
const require_components_banner_function_declaration = require('./banner-function-declaration.cjs');
|
|
3
4
|
const require_components_virtual_command_entry = require('./virtual-command-entry.cjs');
|
|
4
|
-
let
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
let
|
|
11
|
-
let __shell_shock_core = require("@shell-shock/core");
|
|
12
|
-
let __shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
|
|
13
|
-
let __stryke_path_find = require("@stryke/path/find");
|
|
14
|
-
let __stryke_path_join = require("@stryke/path/join");
|
|
15
|
-
let __stryke_path_replace = require("@stryke/path/replace");
|
|
16
|
-
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
17
|
-
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
5
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
7
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
8
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
9
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
10
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
11
|
+
let _shell_shock_core = require("@shell-shock/core");
|
|
18
12
|
let defu = require("defu");
|
|
19
|
-
defu =
|
|
13
|
+
defu = require_runtime.__toESM(defu);
|
|
14
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
15
|
+
let _powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
16
|
+
let _shell_shock_core_components_command_validation_logic = require("@shell-shock/core/components/command-validation-logic");
|
|
17
|
+
let _shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
|
|
18
|
+
let _stryke_path_find = require("@stryke/path/find");
|
|
19
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
20
|
+
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
21
|
+
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
20
22
|
|
|
21
23
|
//#region src/components/command-entry.tsx
|
|
22
24
|
/**
|
|
@@ -24,14 +26,14 @@ defu = require_rolldown_runtime.__toESM(defu);
|
|
|
24
26
|
*/
|
|
25
27
|
function CommandEntry(props) {
|
|
26
28
|
const { command, imports, builtinImports, ...rest } = props;
|
|
27
|
-
const context = (0,
|
|
28
|
-
const filePath = (0,
|
|
29
|
-
const commandSourcePath = (0,
|
|
30
|
-
const typeDefinition = (0,
|
|
29
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
30
|
+
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"));
|
|
31
|
+
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)));
|
|
32
|
+
const typeDefinition = (0, _alloy_js_core.computed)(() => ({
|
|
31
33
|
...command.entry,
|
|
32
34
|
output: command.id
|
|
33
35
|
}));
|
|
34
|
-
return [(0,
|
|
36
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_entry_file.EntryFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
35
37
|
get path() {
|
|
36
38
|
return filePath.value;
|
|
37
39
|
},
|
|
@@ -39,10 +41,7 @@ function CommandEntry(props) {
|
|
|
39
41
|
return typeDefinition.value;
|
|
40
42
|
},
|
|
41
43
|
get imports() {
|
|
42
|
-
return (0, defu.default)(imports ?? {}, {
|
|
43
|
-
[commandSourcePath.value]: `handle${(0, __stryke_string_format_pascal_case.pascalCase)(command.name)}`,
|
|
44
|
-
prompts: "prompts"
|
|
45
|
-
});
|
|
44
|
+
return (0, defu.default)(imports ?? {}, { [commandSourcePath.value.startsWith(".") ? commandSourcePath.value : `./${commandSourcePath.value}`]: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(command.name)}` });
|
|
46
45
|
},
|
|
47
46
|
get builtinImports() {
|
|
48
47
|
return (0, defu.default)(builtinImports ?? {}, {
|
|
@@ -86,83 +85,80 @@ function CommandEntry(props) {
|
|
|
86
85
|
"isCancel",
|
|
87
86
|
"sleep"
|
|
88
87
|
],
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"isCheckForUpdatesRequired",
|
|
92
|
-
"upgrade"
|
|
93
|
-
]
|
|
88
|
+
[(0, _stryke_path_join.joinPaths)("help", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showHelp"],
|
|
89
|
+
upgrade: ["executeUpgrade"]
|
|
94
90
|
});
|
|
95
91
|
},
|
|
96
92
|
get children() {
|
|
97
93
|
return [
|
|
98
|
-
(0,
|
|
99
|
-
(0,
|
|
100
|
-
(0,
|
|
101
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandHandlerDeclaration, {
|
|
94
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_banner_function_declaration.BannerFunctionDeclaration, { command }),
|
|
95
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
96
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_preset_script_components_command_entry.CommandHandlerDeclaration, {
|
|
102
97
|
command,
|
|
103
|
-
banner:
|
|
98
|
+
banner: _alloy_js_core.code`await banner();
|
|
99
|
+
await executeUpgrade(); `,
|
|
104
100
|
get children() {
|
|
105
|
-
return [(0,
|
|
106
|
-
condition:
|
|
101
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
102
|
+
condition: _alloy_js_core.code`!isInteractive`,
|
|
107
103
|
get children() {
|
|
108
|
-
return (0,
|
|
104
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_command_validation_logic.CommandValidationLogic, { command });
|
|
109
105
|
}
|
|
110
|
-
}), (0,
|
|
106
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
111
107
|
get when() {
|
|
112
108
|
return Object.values(command.options ?? {}).filter((option) => !option.optional).length > 0 || Object.values(command.args ?? {}).filter((arg) => !arg.optional).length > 0;
|
|
113
109
|
},
|
|
114
110
|
get children() {
|
|
115
|
-
return (0,
|
|
111
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
116
112
|
get condition() {
|
|
117
|
-
return
|
|
113
|
+
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
114
|
},
|
|
119
115
|
get children() {
|
|
120
116
|
return [
|
|
121
|
-
|
|
122
|
-
(0,
|
|
123
|
-
(0,
|
|
117
|
+
_alloy_js_core.code`writeLine(""); `,
|
|
118
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
119
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
124
120
|
get each() {
|
|
125
121
|
return Object.values(command.options ?? {});
|
|
126
122
|
},
|
|
127
123
|
doubleHardline: true,
|
|
128
|
-
children: (option) => [(0,
|
|
124
|
+
children: (option) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
129
125
|
get when() {
|
|
130
126
|
return !option.optional;
|
|
131
127
|
},
|
|
132
128
|
get children() {
|
|
133
|
-
return [(0,
|
|
129
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
134
130
|
get condition() {
|
|
135
|
-
return
|
|
131
|
+
return _alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}`;
|
|
136
132
|
},
|
|
137
133
|
get children() {
|
|
138
|
-
return (0,
|
|
134
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
139
135
|
get when() {
|
|
140
|
-
return option.kind ===
|
|
136
|
+
return option.kind === _shell_shock_core.CommandParameterKinds.boolean || !option.choices || option.choices.length === 0;
|
|
141
137
|
},
|
|
142
138
|
get fallback() {
|
|
143
|
-
return
|
|
144
|
-
message: \`Please select a value for the \${colors.italic("${option.name}")} option\`, ${option.description ? `description: \`${(0,
|
|
145
|
-
` : ""}options: [ ${option.choices?.map((choice) => `{ value: ${JSON.stringify(choice)}, label: "${choice}", ${option.description ? `description: \`${(0,
|
|
139
|
+
return _alloy_js_core.code`const value = await select({
|
|
140
|
+
message: \`Please select a value for the \${colors.italic("${option.name}")} option\`, ${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
141
|
+
` : ""}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
142
|
});
|
|
147
143
|
if (isCancel(value)) {
|
|
148
144
|
return;
|
|
149
145
|
}
|
|
150
146
|
|
|
151
|
-
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0,
|
|
147
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
152
148
|
`;
|
|
153
149
|
},
|
|
154
150
|
get children() {
|
|
155
|
-
return (0,
|
|
151
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Switch, { get children() {
|
|
156
152
|
return [
|
|
157
|
-
(0,
|
|
153
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
158
154
|
get when() {
|
|
159
|
-
return option.kind ===
|
|
155
|
+
return option.kind === _shell_shock_core.CommandParameterKinds.string;
|
|
160
156
|
},
|
|
161
157
|
get children() {
|
|
162
|
-
return
|
|
158
|
+
return _alloy_js_core.code`
|
|
163
159
|
const value = await text({
|
|
164
160
|
message: \`Please provide a value for the \${colors.italic("${option.name}")} option\`,
|
|
165
|
-
${option.description ? `description: \`${(0,
|
|
161
|
+
${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
166
162
|
` : ""}validate(val) {
|
|
167
163
|
if (!val || val.trim() === "") {
|
|
168
164
|
return "A value must be provided for this option";
|
|
@@ -175,45 +171,45 @@ function CommandEntry(props) {
|
|
|
175
171
|
return;
|
|
176
172
|
}
|
|
177
173
|
|
|
178
|
-
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0,
|
|
174
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
179
175
|
`;
|
|
180
176
|
}
|
|
181
177
|
}),
|
|
182
|
-
(0,
|
|
178
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
183
179
|
get when() {
|
|
184
|
-
return option.kind ===
|
|
180
|
+
return option.kind === _shell_shock_core.CommandParameterKinds.number;
|
|
185
181
|
},
|
|
186
182
|
get children() {
|
|
187
|
-
return
|
|
183
|
+
return _alloy_js_core.code`
|
|
188
184
|
const value = await numeric({
|
|
189
185
|
message: \`Please provide a numeric value for the \${colors.italic("${option.name}")} option\`,
|
|
190
|
-
${option.description ? `description: \`${(0,
|
|
186
|
+
${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
191
187
|
` : ""}
|
|
192
188
|
});
|
|
193
189
|
if (isCancel(value)) {
|
|
194
190
|
return;
|
|
195
191
|
}
|
|
196
192
|
|
|
197
|
-
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0,
|
|
193
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
198
194
|
`;
|
|
199
195
|
}
|
|
200
196
|
}),
|
|
201
|
-
(0,
|
|
197
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
202
198
|
get when() {
|
|
203
|
-
return option.kind ===
|
|
199
|
+
return option.kind === _shell_shock_core.CommandParameterKinds.boolean;
|
|
204
200
|
},
|
|
205
201
|
get children() {
|
|
206
|
-
return
|
|
202
|
+
return _alloy_js_core.code`
|
|
207
203
|
const value = await toggle({
|
|
208
204
|
message: \`Please select a value for the \${colors.italic("${option.name}")} option\`,
|
|
209
|
-
${option.description ? `description: \`${(0,
|
|
205
|
+
${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
210
206
|
` : ""}
|
|
211
207
|
});
|
|
212
208
|
if (isCancel(value)) {
|
|
213
209
|
return;
|
|
214
210
|
}
|
|
215
211
|
|
|
216
|
-
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0,
|
|
212
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
217
213
|
`;
|
|
218
214
|
}
|
|
219
215
|
})
|
|
@@ -222,20 +218,20 @@ function CommandEntry(props) {
|
|
|
222
218
|
}
|
|
223
219
|
});
|
|
224
220
|
}
|
|
225
|
-
}), (0,
|
|
221
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
226
222
|
get when() {
|
|
227
|
-
return (option.kind ===
|
|
223
|
+
return (option.kind === _shell_shock_core.CommandParameterKinds.string || option.kind === _shell_shock_core.CommandParameterKinds.number) && option.variadic;
|
|
228
224
|
},
|
|
229
225
|
get children() {
|
|
230
|
-
return (0,
|
|
226
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
231
227
|
get condition() {
|
|
232
|
-
return
|
|
228
|
+
return _alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
|
|
233
229
|
},
|
|
234
230
|
get children() {
|
|
235
|
-
return
|
|
231
|
+
return _alloy_js_core.code`
|
|
236
232
|
const value = await text({
|
|
237
|
-
message: \`Please provide one or more${option.kind ===
|
|
238
|
-
${option.description ? `description: \`${(0,
|
|
233
|
+
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)\`,
|
|
234
|
+
${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
239
235
|
` : ""}validate(val) {
|
|
240
236
|
if (!val || val.trim() === "") {
|
|
241
237
|
return "A value must be provided for this option";
|
|
@@ -243,7 +239,7 @@ function CommandEntry(props) {
|
|
|
243
239
|
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
244
240
|
return "At least one value must be provided for this option";
|
|
245
241
|
}
|
|
246
|
-
${option.kind ===
|
|
242
|
+
${option.kind === _shell_shock_core.CommandParameterKinds.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
|
|
247
243
|
if (invalidIndex !== -1) {
|
|
248
244
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
249
245
|
} ` : ""}
|
|
@@ -254,7 +250,7 @@ function CommandEntry(props) {
|
|
|
254
250
|
return;
|
|
255
251
|
}
|
|
256
252
|
|
|
257
|
-
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0,
|
|
253
|
+
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)` : ""} ;
|
|
258
254
|
`;
|
|
259
255
|
}
|
|
260
256
|
});
|
|
@@ -263,51 +259,51 @@ function CommandEntry(props) {
|
|
|
263
259
|
}
|
|
264
260
|
})]
|
|
265
261
|
}),
|
|
266
|
-
(0,
|
|
267
|
-
(0,
|
|
262
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
263
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
268
264
|
get each() {
|
|
269
265
|
return command.args;
|
|
270
266
|
},
|
|
271
267
|
doubleHardline: true,
|
|
272
|
-
children: (arg) => [(0,
|
|
268
|
+
children: (arg) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
273
269
|
get when() {
|
|
274
270
|
return !arg.optional;
|
|
275
271
|
},
|
|
276
272
|
get children() {
|
|
277
|
-
return [(0,
|
|
273
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
278
274
|
get condition() {
|
|
279
|
-
return
|
|
275
|
+
return _alloy_js_core.code`!${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}`;
|
|
280
276
|
},
|
|
281
277
|
get children() {
|
|
282
|
-
return (0,
|
|
278
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
283
279
|
get when() {
|
|
284
|
-
return arg.kind ===
|
|
280
|
+
return arg.kind === _shell_shock_core.CommandParameterKinds.boolean || !arg.choices || arg.choices.length === 0;
|
|
285
281
|
},
|
|
286
282
|
get fallback() {
|
|
287
|
-
return
|
|
288
|
-
message: \`Please select a value for the \${colors.italic("${arg.name}")} argument\`,${arg.description ? `description: \`${(0,
|
|
283
|
+
return _alloy_js_core.code`const value = await select({
|
|
284
|
+
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
285
|
` : ""}
|
|
290
|
-
options: [ ${arg.choices?.map((choice) => `{ value: ${JSON.stringify(choice)}, label: "${choice}", ${arg.description ? `description: \`${(0,
|
|
286
|
+
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
287
|
});
|
|
292
288
|
if (isCancel(value)) {
|
|
293
289
|
return;
|
|
294
290
|
}
|
|
295
291
|
|
|
296
|
-
${(0,
|
|
292
|
+
${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
297
293
|
`;
|
|
298
294
|
},
|
|
299
295
|
get children() {
|
|
300
|
-
return (0,
|
|
296
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Switch, { get children() {
|
|
301
297
|
return [
|
|
302
|
-
(0,
|
|
298
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
303
299
|
get when() {
|
|
304
|
-
return arg.kind ===
|
|
300
|
+
return arg.kind === _shell_shock_core.CommandParameterKinds.string;
|
|
305
301
|
},
|
|
306
302
|
get children() {
|
|
307
|
-
return
|
|
303
|
+
return _alloy_js_core.code`
|
|
308
304
|
const value = await text({
|
|
309
305
|
message: \`Please provide a value for the \${colors.italic("${arg.name}")} argument\`,
|
|
310
|
-
${arg.description ? `description: \`${(0,
|
|
306
|
+
${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
311
307
|
` : ""}validate(val) {
|
|
312
308
|
if (!val || val.trim() === "") {
|
|
313
309
|
return "A value must be provided for this argument";
|
|
@@ -320,45 +316,45 @@ function CommandEntry(props) {
|
|
|
320
316
|
return;
|
|
321
317
|
}
|
|
322
318
|
|
|
323
|
-
${(0,
|
|
319
|
+
${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
324
320
|
`;
|
|
325
321
|
}
|
|
326
322
|
}),
|
|
327
|
-
(0,
|
|
323
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
328
324
|
get when() {
|
|
329
|
-
return arg.kind ===
|
|
325
|
+
return arg.kind === _shell_shock_core.CommandParameterKinds.number;
|
|
330
326
|
},
|
|
331
327
|
get children() {
|
|
332
|
-
return
|
|
328
|
+
return _alloy_js_core.code`
|
|
333
329
|
const value = await numeric({
|
|
334
330
|
message: \`Please provide a numeric value for the \${colors.italic("${arg.name}")} argument\`,
|
|
335
|
-
${arg.description ? `description: \`${(0,
|
|
331
|
+
${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
336
332
|
` : ""}
|
|
337
333
|
});
|
|
338
334
|
if (isCancel(value)) {
|
|
339
335
|
return;
|
|
340
336
|
}
|
|
341
337
|
|
|
342
|
-
${(0,
|
|
338
|
+
${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
343
339
|
`;
|
|
344
340
|
}
|
|
345
341
|
}),
|
|
346
|
-
(0,
|
|
342
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
347
343
|
get when() {
|
|
348
|
-
return arg.kind ===
|
|
344
|
+
return arg.kind === _shell_shock_core.CommandParameterKinds.boolean;
|
|
349
345
|
},
|
|
350
346
|
get children() {
|
|
351
|
-
return
|
|
347
|
+
return _alloy_js_core.code`
|
|
352
348
|
const value = await toggle({
|
|
353
349
|
message: \`Please select a value for the \${colors.italic("${arg.name}")} argument\`,
|
|
354
|
-
${arg.description ? `description: \`${(0,
|
|
350
|
+
${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
355
351
|
` : ""}
|
|
356
352
|
});
|
|
357
353
|
if (isCancel(value)) {
|
|
358
354
|
return;
|
|
359
355
|
}
|
|
360
356
|
|
|
361
|
-
${(0,
|
|
357
|
+
${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
362
358
|
`;
|
|
363
359
|
}
|
|
364
360
|
})
|
|
@@ -367,20 +363,20 @@ function CommandEntry(props) {
|
|
|
367
363
|
}
|
|
368
364
|
});
|
|
369
365
|
}
|
|
370
|
-
}), (0,
|
|
366
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
371
367
|
get when() {
|
|
372
|
-
return (arg.kind ===
|
|
368
|
+
return (arg.kind === _shell_shock_core.CommandParameterKinds.string || arg.kind === _shell_shock_core.CommandParameterKinds.number) && arg.variadic;
|
|
373
369
|
},
|
|
374
370
|
get children() {
|
|
375
|
-
return (0,
|
|
371
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
376
372
|
get condition() {
|
|
377
|
-
return
|
|
373
|
+
return _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}.length === 0`;
|
|
378
374
|
},
|
|
379
375
|
get children() {
|
|
380
|
-
return
|
|
376
|
+
return _alloy_js_core.code`
|
|
381
377
|
const value = await text({
|
|
382
|
-
message: \`Please provide one or more${arg.kind ===
|
|
383
|
-
${arg.description ? `description: \`${(0,
|
|
378
|
+
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)\`,
|
|
379
|
+
${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
384
380
|
` : ""}validate(val) {
|
|
385
381
|
if (!val || val.trim() === "") {
|
|
386
382
|
return "A value must be provided for this argument";
|
|
@@ -388,7 +384,7 @@ function CommandEntry(props) {
|
|
|
388
384
|
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
389
385
|
return "At least one value must be provided for this argument";
|
|
390
386
|
}
|
|
391
|
-
${arg.kind ===
|
|
387
|
+
${arg.kind === _shell_shock_core.CommandParameterKinds.number ? `const invalidIndex = val.split(",").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));
|
|
392
388
|
if (invalidIndex !== -1) {
|
|
393
389
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
394
390
|
} ` : ""}
|
|
@@ -400,7 +396,7 @@ function CommandEntry(props) {
|
|
|
400
396
|
return;
|
|
401
397
|
}
|
|
402
398
|
|
|
403
|
-
${(0,
|
|
399
|
+
${(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)` : ""} ;
|
|
404
400
|
`;
|
|
405
401
|
}
|
|
406
402
|
});
|
|
@@ -409,8 +405,14 @@ function CommandEntry(props) {
|
|
|
409
405
|
}
|
|
410
406
|
})]
|
|
411
407
|
}),
|
|
412
|
-
|
|
413
|
-
(0,
|
|
408
|
+
_alloy_js_core.code`writeLine(""); `,
|
|
409
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
410
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_command_validation_logic.CommandValidationLogic, { command }),
|
|
411
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
412
|
+
condition: _alloy_js_core.code`failures.length > 0`,
|
|
413
|
+
children: _alloy_js_core.code`error("The following validation failures were found while processing the user provided input, and must be corrected before the command-line process can be executed: \\n\\n" + failures.map(failure => " - " + failure).join("\\n"));
|
|
414
|
+
options.help = true; `
|
|
415
|
+
})
|
|
414
416
|
];
|
|
415
417
|
}
|
|
416
418
|
});
|
|
@@ -420,19 +422,19 @@ function CommandEntry(props) {
|
|
|
420
422
|
})
|
|
421
423
|
];
|
|
422
424
|
}
|
|
423
|
-
})), (0,
|
|
425
|
+
})), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
424
426
|
get each() {
|
|
425
427
|
return Object.values(command.children);
|
|
426
428
|
},
|
|
427
|
-
children: (child) => (0,
|
|
429
|
+
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
428
430
|
get when() {
|
|
429
431
|
return child.isVirtual;
|
|
430
432
|
},
|
|
431
433
|
get fallback() {
|
|
432
|
-
return (0,
|
|
434
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(CommandEntry, { command: child });
|
|
433
435
|
},
|
|
434
436
|
get children() {
|
|
435
|
-
return (0,
|
|
437
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
|
|
436
438
|
}
|
|
437
439
|
})
|
|
438
440
|
})];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"
|
|
1
|
+
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"mappings":";;;;;UA+CiB,iBAAA,SAA0B,IAAA,CACzC,cAAA;EAGA,OAAA,EAAS,WAAA;AAAA;AAJX;;;AAAA,iBAUgB,YAAA,CAAa,KAAA,EAAO,iBAAA,GAAiB,eAAA,CAAA,QAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
2
|
import { CommandTree } from "@shell-shock/core";
|
|
3
|
+
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
4
4
|
|
|
5
5
|
//#region src/components/command-entry.d.ts
|
|
6
6
|
interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
|
|
@@ -9,7 +9,7 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
|
|
|
9
9
|
/**
|
|
10
10
|
* The command entry point for the Shell Shock project.
|
|
11
11
|
*/
|
|
12
|
-
declare function CommandEntry(props: CommandEntryProps):
|
|
12
|
+
declare function CommandEntry(props: CommandEntryProps): _alloy_js_core0.Children;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { CommandEntry, CommandEntryProps };
|
|
15
15
|
//# sourceMappingURL=command-entry.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"
|
|
1
|
+
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"mappings":";;;;;UA+CiB,iBAAA,SAA0B,IAAA,CACzC,cAAA;EAGA,OAAA,EAAS,WAAA;AAAA;AAJX;;;AAAA,iBAUgB,YAAA,CAAa,KAAA,EAAO,iBAAA,GAAiB,eAAA,CAAA,QAAA"}
|