@shell-shock/preset-cli 0.7.13 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
- package/dist/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/components/banner-function-declaration.cjs +48 -164
- package/dist/components/banner-function-declaration.d.cts +2 -2
- package/dist/components/banner-function-declaration.d.cts.map +1 -1
- package/dist/components/banner-function-declaration.d.mts +2 -2
- package/dist/components/banner-function-declaration.d.mts.map +1 -1
- package/dist/components/banner-function-declaration.mjs +29 -146
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/command-entry.cjs +185 -144
- package/dist/components/command-entry.d.cts +2 -2
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +3 -3
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +124 -84
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +20 -18
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/command-router.d.mts.map +1 -1
- package/dist/components/command-router.mjs +2 -1
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/index.cjs +4 -0
- package/dist/components/index.d.cts +2 -1
- package/dist/components/index.d.mts +2 -1
- package/dist/components/index.mjs +2 -1
- package/dist/components/upgrade-builtin.cjs +171 -0
- package/dist/components/upgrade-builtin.d.cts +15 -0
- package/dist/components/upgrade-builtin.d.cts.map +1 -0
- package/dist/components/upgrade-builtin.d.mts +15 -0
- package/dist/components/upgrade-builtin.d.mts.map +1 -0
- package/dist/components/upgrade-builtin.mjs +169 -0
- package/dist/components/upgrade-builtin.mjs.map +1 -0
- package/dist/components/virtual-command-entry.cjs +26 -24
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts +1 -1
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +7 -6
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +6 -6
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +49 -62
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +23 -36
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-help/dist/components/display.cjs +259 -0
- package/dist/plugin-help/dist/components/display.mjs +254 -0
- package/dist/plugin-help/dist/components/display.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-builtin.cjs +85 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs +84 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-command.cjs +96 -0
- package/dist/plugin-help/dist/components/help-command.mjs +96 -0
- package/dist/plugin-help/dist/components/help-command.mjs.map +1 -0
- package/dist/plugin-help/dist/components/index.cjs +3 -0
- package/dist/plugin-help/dist/components/index.mjs +5 -0
- package/dist/plugin-help/dist/index.cjs +103 -0
- package/dist/plugin-help/dist/index.d.cts +2 -0
- package/dist/plugin-help/dist/index.d.mts +2 -0
- package/dist/plugin-help/dist/index.mjs +100 -0
- package/dist/plugin-help/dist/index.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.cjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.cjs +38 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs +38 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs +33 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs +34 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs +40 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs +41 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.cjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.cjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.cjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.cjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.cjs +19 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.cjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.cjs +8 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs +8 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.cts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.cts.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.mts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/plugin.d.cts +20 -34
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +20 -34
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +30 -16
|
@@ -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,66 +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,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
134
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
135
|
+
get when() {
|
|
136
|
+
return option.kind === _shell_shock_core.CommandParameterKinds.boolean || !option.choices || option.choices.length === 0;
|
|
137
|
+
},
|
|
138
|
+
get fallback() {
|
|
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(", ")} ]
|
|
142
|
+
});
|
|
143
|
+
if (isCancel(value)) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
148
|
+
`;
|
|
149
|
+
},
|
|
150
|
+
get children() {
|
|
151
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Switch, { get children() {
|
|
152
|
+
return [
|
|
153
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
154
|
+
get when() {
|
|
155
|
+
return option.kind === _shell_shock_core.CommandParameterKinds.string;
|
|
156
|
+
},
|
|
157
|
+
get children() {
|
|
158
|
+
return _alloy_js_core.code`
|
|
146
159
|
const value = await text({
|
|
147
160
|
message: \`Please provide a value for the \${colors.italic("${option.name}")} option\`,
|
|
148
|
-
${option.description ? `description:
|
|
161
|
+
${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
149
162
|
` : ""}validate(val) {
|
|
150
163
|
if (!val || val.trim() === "") {
|
|
151
164
|
return "A value must be provided for this option";
|
|
@@ -158,65 +171,67 @@ function CommandEntry(props) {
|
|
|
158
171
|
return;
|
|
159
172
|
}
|
|
160
173
|
|
|
161
|
-
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0,
|
|
174
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
162
175
|
`;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
176
|
+
}
|
|
177
|
+
}),
|
|
178
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
179
|
+
get when() {
|
|
180
|
+
return option.kind === _shell_shock_core.CommandParameterKinds.number;
|
|
181
|
+
},
|
|
182
|
+
get children() {
|
|
183
|
+
return _alloy_js_core.code`
|
|
171
184
|
const value = await numeric({
|
|
172
185
|
message: \`Please provide a numeric value for the \${colors.italic("${option.name}")} option\`,
|
|
173
|
-
${option.description ? `description:
|
|
186
|
+
${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
174
187
|
` : ""}
|
|
175
188
|
});
|
|
176
189
|
if (isCancel(value)) {
|
|
177
190
|
return;
|
|
178
191
|
}
|
|
179
192
|
|
|
180
|
-
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0,
|
|
193
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
181
194
|
`;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
195
|
+
}
|
|
196
|
+
}),
|
|
197
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
198
|
+
get when() {
|
|
199
|
+
return option.kind === _shell_shock_core.CommandParameterKinds.boolean;
|
|
200
|
+
},
|
|
201
|
+
get children() {
|
|
202
|
+
return _alloy_js_core.code`
|
|
190
203
|
const value = await toggle({
|
|
191
204
|
message: \`Please select a value for the \${colors.italic("${option.name}")} option\`,
|
|
192
|
-
${option.description ? `description:
|
|
205
|
+
${option.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatDescription)(option.description)}\`,
|
|
193
206
|
` : ""}
|
|
194
207
|
});
|
|
195
208
|
if (isCancel(value)) {
|
|
196
209
|
return;
|
|
197
210
|
}
|
|
198
211
|
|
|
199
|
-
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0,
|
|
212
|
+
options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`} = value;
|
|
200
213
|
`;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
];
|
|
217
|
+
} });
|
|
218
|
+
}
|
|
219
|
+
});
|
|
205
220
|
}
|
|
206
|
-
}), (0,
|
|
221
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
207
222
|
get when() {
|
|
208
|
-
return (option.kind ===
|
|
223
|
+
return (option.kind === _shell_shock_core.CommandParameterKinds.string || option.kind === _shell_shock_core.CommandParameterKinds.number) && option.variadic;
|
|
209
224
|
},
|
|
210
225
|
get children() {
|
|
211
|
-
return (0,
|
|
226
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
212
227
|
get condition() {
|
|
213
|
-
return
|
|
228
|
+
return _alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, _stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
|
|
214
229
|
},
|
|
215
230
|
get children() {
|
|
216
|
-
return
|
|
231
|
+
return _alloy_js_core.code`
|
|
217
232
|
const value = await text({
|
|
218
|
-
message: \`Please provide one or more${option.kind ===
|
|
219
|
-
${option.description ? `description:
|
|
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)}\`,
|
|
220
235
|
` : ""}validate(val) {
|
|
221
236
|
if (!val || val.trim() === "") {
|
|
222
237
|
return "A value must be provided for this option";
|
|
@@ -224,7 +239,7 @@ function CommandEntry(props) {
|
|
|
224
239
|
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
225
240
|
return "At least one value must be provided for this option";
|
|
226
241
|
}
|
|
227
|
-
${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));
|
|
228
243
|
if (invalidIndex !== -1) {
|
|
229
244
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
230
245
|
} ` : ""}
|
|
@@ -235,7 +250,7 @@ function CommandEntry(props) {
|
|
|
235
250
|
return;
|
|
236
251
|
}
|
|
237
252
|
|
|
238
|
-
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)` : ""} ;
|
|
239
254
|
`;
|
|
240
255
|
}
|
|
241
256
|
});
|
|
@@ -244,33 +259,51 @@ function CommandEntry(props) {
|
|
|
244
259
|
}
|
|
245
260
|
})]
|
|
246
261
|
}),
|
|
247
|
-
(0,
|
|
248
|
-
(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, {
|
|
249
264
|
get each() {
|
|
250
265
|
return command.args;
|
|
251
266
|
},
|
|
252
267
|
doubleHardline: true,
|
|
253
|
-
children: (arg) => [(0,
|
|
268
|
+
children: (arg) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
254
269
|
get when() {
|
|
255
270
|
return !arg.optional;
|
|
256
271
|
},
|
|
257
272
|
get children() {
|
|
258
|
-
return [(0,
|
|
273
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
259
274
|
get condition() {
|
|
260
|
-
return
|
|
275
|
+
return _alloy_js_core.code`!${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}`;
|
|
261
276
|
},
|
|
262
277
|
get children() {
|
|
263
|
-
return (0,
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
278
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
279
|
+
get when() {
|
|
280
|
+
return arg.kind === _shell_shock_core.CommandParameterKinds.boolean || !arg.choices || arg.choices.length === 0;
|
|
281
|
+
},
|
|
282
|
+
get fallback() {
|
|
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)}\`,
|
|
285
|
+
` : ""}
|
|
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(", ")} ]
|
|
287
|
+
});
|
|
288
|
+
if (isCancel(value)) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
293
|
+
`;
|
|
294
|
+
},
|
|
295
|
+
get children() {
|
|
296
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Switch, { get children() {
|
|
297
|
+
return [
|
|
298
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
299
|
+
get when() {
|
|
300
|
+
return arg.kind === _shell_shock_core.CommandParameterKinds.string;
|
|
301
|
+
},
|
|
302
|
+
get children() {
|
|
303
|
+
return _alloy_js_core.code`
|
|
271
304
|
const value = await text({
|
|
272
305
|
message: \`Please provide a value for the \${colors.italic("${arg.name}")} argument\`,
|
|
273
|
-
${arg.description ? `description:
|
|
306
|
+
${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
274
307
|
` : ""}validate(val) {
|
|
275
308
|
if (!val || val.trim() === "") {
|
|
276
309
|
return "A value must be provided for this argument";
|
|
@@ -283,65 +316,67 @@ function CommandEntry(props) {
|
|
|
283
316
|
return;
|
|
284
317
|
}
|
|
285
318
|
|
|
286
|
-
${(0,
|
|
319
|
+
${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
287
320
|
`;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
321
|
+
}
|
|
322
|
+
}),
|
|
323
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
324
|
+
get when() {
|
|
325
|
+
return arg.kind === _shell_shock_core.CommandParameterKinds.number;
|
|
326
|
+
},
|
|
327
|
+
get children() {
|
|
328
|
+
return _alloy_js_core.code`
|
|
296
329
|
const value = await numeric({
|
|
297
330
|
message: \`Please provide a numeric value for the \${colors.italic("${arg.name}")} argument\`,
|
|
298
|
-
${arg.description ? `description:
|
|
331
|
+
${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
299
332
|
` : ""}
|
|
300
333
|
});
|
|
301
334
|
if (isCancel(value)) {
|
|
302
335
|
return;
|
|
303
336
|
}
|
|
304
337
|
|
|
305
|
-
${(0,
|
|
338
|
+
${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
306
339
|
`;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
340
|
+
}
|
|
341
|
+
}),
|
|
342
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
343
|
+
get when() {
|
|
344
|
+
return arg.kind === _shell_shock_core.CommandParameterKinds.boolean;
|
|
345
|
+
},
|
|
346
|
+
get children() {
|
|
347
|
+
return _alloy_js_core.code`
|
|
315
348
|
const value = await toggle({
|
|
316
349
|
message: \`Please select a value for the \${colors.italic("${arg.name}")} argument\`,
|
|
317
|
-
${arg.description ? `description:
|
|
350
|
+
${arg.description ? `description: \`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(arg.description)}\`,
|
|
318
351
|
` : ""}
|
|
319
352
|
});
|
|
320
353
|
if (isCancel(value)) {
|
|
321
354
|
return;
|
|
322
355
|
}
|
|
323
356
|
|
|
324
|
-
${(0,
|
|
357
|
+
${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = value;
|
|
325
358
|
`;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
359
|
+
}
|
|
360
|
+
})
|
|
361
|
+
];
|
|
362
|
+
} });
|
|
363
|
+
}
|
|
364
|
+
});
|
|
330
365
|
}
|
|
331
|
-
}), (0,
|
|
366
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
332
367
|
get when() {
|
|
333
|
-
return (arg.kind ===
|
|
368
|
+
return (arg.kind === _shell_shock_core.CommandParameterKinds.string || arg.kind === _shell_shock_core.CommandParameterKinds.number) && arg.variadic;
|
|
334
369
|
},
|
|
335
370
|
get children() {
|
|
336
|
-
return (0,
|
|
371
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
337
372
|
get condition() {
|
|
338
|
-
return
|
|
373
|
+
return _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}.length === 0`;
|
|
339
374
|
},
|
|
340
375
|
get children() {
|
|
341
|
-
return
|
|
376
|
+
return _alloy_js_core.code`
|
|
342
377
|
const value = await text({
|
|
343
|
-
message: \`Please provide one or more${arg.kind ===
|
|
344
|
-
${arg.description ? `description:
|
|
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)}\`,
|
|
345
380
|
` : ""}validate(val) {
|
|
346
381
|
if (!val || val.trim() === "") {
|
|
347
382
|
return "A value must be provided for this argument";
|
|
@@ -349,7 +384,7 @@ function CommandEntry(props) {
|
|
|
349
384
|
if (val.split(",").map(v => v.trim()).filter(Boolean).length === 0) {
|
|
350
385
|
return "At least one value must be provided for this argument";
|
|
351
386
|
}
|
|
352
|
-
${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));
|
|
353
388
|
if (invalidIndex !== -1) {
|
|
354
389
|
return \`Invalid numeric value provided for item #\${invalidIndex + 1} - all provided items must be a valid number\`;
|
|
355
390
|
} ` : ""}
|
|
@@ -361,7 +396,7 @@ function CommandEntry(props) {
|
|
|
361
396
|
return;
|
|
362
397
|
}
|
|
363
398
|
|
|
364
|
-
${(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)` : ""} ;
|
|
365
400
|
`;
|
|
366
401
|
}
|
|
367
402
|
});
|
|
@@ -370,8 +405,14 @@ function CommandEntry(props) {
|
|
|
370
405
|
}
|
|
371
406
|
})]
|
|
372
407
|
}),
|
|
373
|
-
|
|
374
|
-
(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
|
+
})
|
|
375
416
|
];
|
|
376
417
|
}
|
|
377
418
|
});
|
|
@@ -381,19 +422,19 @@ function CommandEntry(props) {
|
|
|
381
422
|
})
|
|
382
423
|
];
|
|
383
424
|
}
|
|
384
|
-
})), (0,
|
|
425
|
+
})), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
385
426
|
get each() {
|
|
386
427
|
return Object.values(command.children);
|
|
387
428
|
},
|
|
388
|
-
children: (child) => (0,
|
|
429
|
+
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
389
430
|
get when() {
|
|
390
431
|
return child.isVirtual;
|
|
391
432
|
},
|
|
392
433
|
get fallback() {
|
|
393
|
-
return (0,
|
|
434
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(CommandEntry, { command: child });
|
|
394
435
|
},
|
|
395
436
|
get children() {
|
|
396
|
-
return (0,
|
|
437
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
|
|
397
438
|
}
|
|
398
439
|
})
|
|
399
440
|
})];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core";
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
|
|
|
9
9
|
/**
|
|
10
10
|
* The command entry point for the Shell Shock project.
|
|
11
11
|
*/
|
|
12
|
-
declare function CommandEntry(props: CommandEntryProps):
|
|
12
|
+
declare function CommandEntry(props: CommandEntryProps): _alloy_js_core0.Children;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { CommandEntry, CommandEntryProps };
|
|
15
15
|
//# sourceMappingURL=command-entry.d.cts.map
|
|
@@ -1 +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"}
|