@shell-shock/preset-script 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/args-parser-logic.cjs +678 -0
- package/dist/components/args-parser-logic.cjs.map +1 -0
- package/dist/components/args-parser-logic.d.cts +45 -0
- package/dist/components/args-parser-logic.d.cts.map +1 -0
- package/dist/components/args-parser-logic.d.mts +45 -0
- package/dist/components/args-parser-logic.d.mts.map +1 -0
- package/dist/components/args-parser-logic.mjs +672 -0
- package/dist/components/args-parser-logic.mjs.map +1 -0
- package/dist/components/bin-entry.cjs +188 -0
- package/dist/components/bin-entry.cjs.map +1 -0
- package/dist/components/{entry/bin.d.cts → bin-entry.d.cts} +9 -3
- package/dist/components/bin-entry.d.cts.map +1 -0
- package/dist/components/{entry/bin.d.mts → bin-entry.d.mts} +9 -3
- package/dist/components/bin-entry.d.mts.map +1 -0
- package/dist/components/bin-entry.mjs +185 -0
- package/dist/components/bin-entry.mjs.map +1 -0
- package/dist/components/command-entry.cjs +162 -0
- package/dist/components/command-entry.cjs.map +1 -0
- package/dist/components/command-entry.d.cts +24 -0
- package/dist/components/command-entry.d.cts.map +1 -0
- package/dist/components/command-entry.d.mts +24 -0
- package/dist/components/command-entry.d.mts.map +1 -0
- package/dist/components/command-entry.mjs +158 -0
- package/dist/components/command-entry.mjs.map +1 -0
- package/dist/components/command-router.cjs +129 -74
- package/dist/components/command-router.cjs.map +1 -1
- package/dist/components/command-router.d.cts +13 -4
- package/dist/components/command-router.d.cts.map +1 -0
- package/dist/components/command-router.d.mts +13 -4
- package/dist/components/command-router.d.mts.map +1 -0
- package/dist/components/command-router.mjs +128 -73
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/console-builtin.cjs +2086 -0
- package/dist/components/console-builtin.cjs.map +1 -0
- package/dist/components/console-builtin.d.cts +56 -0
- package/dist/components/console-builtin.d.cts.map +1 -0
- package/dist/components/console-builtin.d.mts +56 -0
- package/dist/components/console-builtin.d.mts.map +1 -0
- package/dist/components/console-builtin.mjs +2077 -0
- package/dist/components/console-builtin.mjs.map +1 -0
- package/dist/components/help.cjs +130 -0
- package/dist/components/help.cjs.map +1 -0
- package/dist/components/help.d.cts +57 -0
- package/dist/components/help.d.cts.map +1 -0
- package/dist/components/help.d.mts +57 -0
- package/dist/components/help.d.mts.map +1 -0
- package/dist/components/help.mjs +126 -0
- package/dist/components/help.mjs.map +1 -0
- package/dist/components/index.cjs +39 -15
- package/dist/components/index.d.cts +9 -7
- package/dist/components/index.d.mts +9 -7
- package/dist/components/index.mjs +8 -6
- package/dist/components/utils-builtin.cjs +612 -0
- package/dist/components/utils-builtin.cjs.map +1 -0
- package/dist/components/utils-builtin.d.cts +32 -0
- package/dist/components/utils-builtin.d.cts.map +1 -0
- package/dist/components/utils-builtin.d.mts +32 -0
- package/dist/components/utils-builtin.d.mts.map +1 -0
- package/dist/components/utils-builtin.mjs +605 -0
- package/dist/components/utils-builtin.mjs.map +1 -0
- package/dist/components/virtual-command-entry.cjs +140 -0
- package/dist/components/virtual-command-entry.cjs.map +1 -0
- package/dist/components/virtual-command-entry.d.cts +21 -0
- package/dist/components/virtual-command-entry.d.cts.map +1 -0
- package/dist/components/virtual-command-entry.d.mts +21 -0
- package/dist/components/virtual-command-entry.d.mts.map +1 -0
- package/dist/components/virtual-command-entry.mjs +137 -0
- package/dist/components/virtual-command-entry.mjs.map +1 -0
- package/dist/contexts/index.cjs +4 -0
- package/dist/contexts/index.d.cts +2 -0
- package/dist/contexts/index.d.mts +2 -0
- package/dist/contexts/index.mjs +3 -0
- package/dist/contexts/theme.d.cts +20 -0
- package/dist/contexts/theme.d.cts.map +1 -0
- package/dist/contexts/theme.d.mts +20 -0
- package/dist/contexts/theme.d.mts.map +1 -0
- package/dist/helpers/ansi-utils.cjs +28 -4
- package/dist/helpers/ansi-utils.cjs.map +1 -1
- package/dist/helpers/ansi-utils.d.cts +68 -0
- package/dist/helpers/ansi-utils.d.cts.map +1 -0
- package/dist/helpers/ansi-utils.d.mts +68 -0
- package/dist/helpers/ansi-utils.d.mts.map +1 -0
- package/dist/helpers/ansi-utils.mjs +28 -4
- package/dist/helpers/ansi-utils.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +6 -13
- package/dist/helpers/get-default-options.cjs.map +1 -1
- package/dist/helpers/get-default-options.mjs +6 -13
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +117 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +118 -28
- package/dist/index.mjs.map +1 -1
- package/dist/types/plugin.d.cts +1 -6
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +1 -6
- package/dist/types/plugin.d.mts.map +1 -0
- package/package.json +163 -71
- package/dist/components/builtin/console.cjs +0 -1232
- package/dist/components/builtin/console.cjs.map +0 -1
- package/dist/components/builtin/console.d.cts +0 -37
- package/dist/components/builtin/console.d.mts +0 -37
- package/dist/components/builtin/console.mjs +0 -1225
- package/dist/components/builtin/console.mjs.map +0 -1
- package/dist/components/builtin/index.cjs +0 -9
- package/dist/components/builtin/index.d.cts +0 -2
- package/dist/components/builtin/index.d.mts +0 -2
- package/dist/components/builtin/index.mjs +0 -3
- package/dist/components/entry/bin.cjs +0 -92
- package/dist/components/entry/bin.cjs.map +0 -1
- package/dist/components/entry/bin.mjs +0 -91
- package/dist/components/entry/bin.mjs.map +0 -1
- package/dist/components/entry/command.cjs +0 -54
- package/dist/components/entry/command.cjs.map +0 -1
- package/dist/components/entry/command.d.cts +0 -15
- package/dist/components/entry/command.d.mts +0 -15
- package/dist/components/entry/command.mjs +0 -53
- package/dist/components/entry/command.mjs.map +0 -1
- package/dist/components/entry/index.cjs +0 -3
- package/dist/components/entry/index.d.cts +0 -2
- package/dist/components/entry/index.d.mts +0 -2
- package/dist/components/entry/index.mjs +0 -3
- package/dist/components/shutdown.cjs +0 -93
- package/dist/components/shutdown.cjs.map +0 -1
- package/dist/components/shutdown.d.cts +0 -14
- package/dist/components/shutdown.d.mts +0 -14
- package/dist/components/shutdown.mjs +0 -91
- package/dist/components/shutdown.mjs.map +0 -1
- package/dist/contexts/command.cjs +0 -21
- package/dist/contexts/command.cjs.map +0 -1
- package/dist/contexts/command.mjs +0 -19
- package/dist/contexts/command.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the ⚡<b>Shell Shock</b> monorepo. The Shell Shock pack
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://stormsoftware.com/projects/shell-shock/) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
4
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
5
|
+
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
6
|
+
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
7
|
+
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
8
|
+
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
9
|
+
let __stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
10
|
+
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
11
|
+
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
12
|
+
|
|
13
|
+
//#region src/components/args-parser-logic.tsx
|
|
14
|
+
function VariablePathsParserLogic(props) {
|
|
15
|
+
const { path } = props;
|
|
16
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
17
|
+
get each() {
|
|
18
|
+
return path.segments ?? [];
|
|
19
|
+
},
|
|
20
|
+
children: (segment, index) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
21
|
+
get when() {
|
|
22
|
+
return (0, __shell_shock_core_plugin_utils_context_helpers.isVariableCommandPath)(segment);
|
|
23
|
+
},
|
|
24
|
+
get children() {
|
|
25
|
+
return [
|
|
26
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
27
|
+
"let": true,
|
|
28
|
+
get name() {
|
|
29
|
+
return (0, __stryke_string_format_camel_case.camelCase)((0, __shell_shock_core_plugin_utils_context_helpers.getVariableCommandPathName)(segment));
|
|
30
|
+
},
|
|
31
|
+
type: "string | undefined",
|
|
32
|
+
get initializer() {
|
|
33
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
34
|
+
get when() {
|
|
35
|
+
return (0, __stryke_type_checks_is_set_string.isSetString)(path.variables[(0, __shell_shock_core_plugin_utils_context_helpers.getVariableCommandPathName)(segment)]?.default);
|
|
36
|
+
},
|
|
37
|
+
fallback: __alloy_js_core.code`undefined;`,
|
|
38
|
+
get children() {
|
|
39
|
+
return __alloy_js_core.code` ?? "${path.variables[(0, __shell_shock_core_plugin_utils_context_helpers.getVariableCommandPathName)(segment)]?.default}";`;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
44
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
45
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
46
|
+
condition: __alloy_js_core.code`args.length > ${2 + index} && args[${2 + index}]`,
|
|
47
|
+
get children() {
|
|
48
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)((0, __shell_shock_core_plugin_utils_context_helpers.getVariableCommandPathName)(segment))} = args[${2 + index}];`;
|
|
49
|
+
}
|
|
50
|
+
}),
|
|
51
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
52
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
53
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
54
|
+
get when() {
|
|
55
|
+
return !path.variables[(0, __shell_shock_core_plugin_utils_context_helpers.getVariableCommandPathName)(segment)]?.optional;
|
|
56
|
+
},
|
|
57
|
+
get children() {
|
|
58
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
59
|
+
get condition() {
|
|
60
|
+
return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)((0, __shell_shock_core_plugin_utils_context_helpers.getVariableCommandPathName)(segment))}`;
|
|
61
|
+
},
|
|
62
|
+
get children() {
|
|
63
|
+
return [(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`error(\`Missing required command path variable: "${(0, __shell_shock_core_plugin_utils_context_helpers.getVariableCommandPathName)(segment)}".\`);`), __alloy_js_core.code`return;`];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The command parameter parser logic.
|
|
76
|
+
*/
|
|
77
|
+
function ParamsParserLogic(props) {
|
|
78
|
+
const { params } = props;
|
|
79
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
80
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
81
|
+
get when() {
|
|
82
|
+
return params && params.length > 0;
|
|
83
|
+
},
|
|
84
|
+
get children() {
|
|
85
|
+
return [
|
|
86
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
87
|
+
each: params ?? [],
|
|
88
|
+
hardline: true,
|
|
89
|
+
children: (param) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
90
|
+
"let": true,
|
|
91
|
+
get name() {
|
|
92
|
+
return (0, __stryke_string_format_camel_case.camelCase)(param.name);
|
|
93
|
+
},
|
|
94
|
+
get type() {
|
|
95
|
+
return param.variadic ? "string[]" : "string | undefined";
|
|
96
|
+
},
|
|
97
|
+
get initializer() {
|
|
98
|
+
return (0, __alloy_js_core_jsx_runtime.memo)(() => !!param.variadic)() ? __alloy_js_core.code`[]` : [
|
|
99
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`env.${context.config.envPrefix}_${(0, __stryke_string_format_constant_case.constantCase)(param.name)} ?? `),
|
|
100
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
101
|
+
get when() {
|
|
102
|
+
return (0, __stryke_type_checks_is_set_string.isSetString)(param.default);
|
|
103
|
+
},
|
|
104
|
+
get children() {
|
|
105
|
+
return __alloy_js_core.code`"${param.default}"`;
|
|
106
|
+
}
|
|
107
|
+
}),
|
|
108
|
+
__alloy_js_core.code`undefined;`
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
}),
|
|
113
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
114
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
115
|
+
"const": true,
|
|
116
|
+
name: "argsDiv",
|
|
117
|
+
type: "number",
|
|
118
|
+
initializer: __alloy_js_core.code` args.findIndex(arg => arg === "--");`
|
|
119
|
+
}),
|
|
120
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
121
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
122
|
+
condition: __alloy_js_core.code`argsDiv !== -1`,
|
|
123
|
+
get children() {
|
|
124
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
125
|
+
each: params ?? [],
|
|
126
|
+
hardline: true,
|
|
127
|
+
children: (param, index) => [
|
|
128
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
129
|
+
condition: __alloy_js_core.code`args.length > argsDiv + ${index + 1} && args[argsDiv + ${index + 1}]`,
|
|
130
|
+
get children() {
|
|
131
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
132
|
+
get when() {
|
|
133
|
+
return param.variadic;
|
|
134
|
+
},
|
|
135
|
+
get fallback() {
|
|
136
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(param.name)} = args[argsDiv + ${index + 1}];`;
|
|
137
|
+
},
|
|
138
|
+
get children() {
|
|
139
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(param.name)}.push(args[argsDiv + ${index + 1}]);`;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}),
|
|
144
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
145
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
146
|
+
get when() {
|
|
147
|
+
return !param.optional;
|
|
148
|
+
},
|
|
149
|
+
get children() {
|
|
150
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
151
|
+
get when() {
|
|
152
|
+
return !param.default;
|
|
153
|
+
},
|
|
154
|
+
get fallback() {
|
|
155
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseClause, { get children() {
|
|
156
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(param.name)} = "${param.default}";`;
|
|
157
|
+
} });
|
|
158
|
+
},
|
|
159
|
+
get children() {
|
|
160
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseClause, { get children() {
|
|
161
|
+
return [(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`error(\`Missing required command parameter: "${param.name}".\`);`), __alloy_js_core.code`return;`];
|
|
162
|
+
} });
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}),
|
|
167
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
168
|
+
]
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
})
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The command option interface property.
|
|
178
|
+
*/
|
|
179
|
+
function OptionsMember({ name, option }) {
|
|
180
|
+
const doc = option.description || `The ${option.title} command option.`;
|
|
181
|
+
return [
|
|
182
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
183
|
+
get when() {
|
|
184
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
185
|
+
},
|
|
186
|
+
get children() {
|
|
187
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceMember, {
|
|
188
|
+
name,
|
|
189
|
+
doc,
|
|
190
|
+
get type() {
|
|
191
|
+
return option.variadic ? "string[]" : "string";
|
|
192
|
+
},
|
|
193
|
+
get optional() {
|
|
194
|
+
return option.optional;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}),
|
|
199
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
200
|
+
get when() {
|
|
201
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
202
|
+
},
|
|
203
|
+
get children() {
|
|
204
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceMember, {
|
|
205
|
+
name,
|
|
206
|
+
doc,
|
|
207
|
+
get type() {
|
|
208
|
+
return option.variadic ? "number[]" : "number";
|
|
209
|
+
},
|
|
210
|
+
get optional() {
|
|
211
|
+
return option.optional;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}),
|
|
216
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
217
|
+
get when() {
|
|
218
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean;
|
|
219
|
+
},
|
|
220
|
+
get children() {
|
|
221
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceMember, {
|
|
222
|
+
name,
|
|
223
|
+
doc,
|
|
224
|
+
type: "boolean",
|
|
225
|
+
get optional() {
|
|
226
|
+
return option.optional;
|
|
227
|
+
}
|
|
228
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
229
|
+
get when() {
|
|
230
|
+
return Boolean(option.isNegativeOf);
|
|
231
|
+
},
|
|
232
|
+
get children() {
|
|
233
|
+
return [(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceMember, {
|
|
234
|
+
get name() {
|
|
235
|
+
return option.isNegativeOf;
|
|
236
|
+
},
|
|
237
|
+
doc,
|
|
238
|
+
type: "boolean",
|
|
239
|
+
get optional() {
|
|
240
|
+
return option.optional;
|
|
241
|
+
}
|
|
242
|
+
})];
|
|
243
|
+
}
|
|
244
|
+
})];
|
|
245
|
+
}
|
|
246
|
+
}),
|
|
247
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
248
|
+
get when() {
|
|
249
|
+
return option.alias && option.alias.length > 0;
|
|
250
|
+
},
|
|
251
|
+
get children() {
|
|
252
|
+
return [(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
253
|
+
get each() {
|
|
254
|
+
return option.alias ?? [];
|
|
255
|
+
},
|
|
256
|
+
hardline: true,
|
|
257
|
+
children: (alias) => (0, __alloy_js_core_jsx_runtime.createComponent)(OptionsMember, {
|
|
258
|
+
name: alias,
|
|
259
|
+
get option() {
|
|
260
|
+
return {
|
|
261
|
+
...option,
|
|
262
|
+
alias: [],
|
|
263
|
+
description: `${doc.replace(/\.+$/, "")}. This property is an alias for ${name}.`
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
})
|
|
267
|
+
})];
|
|
268
|
+
}
|
|
269
|
+
})
|
|
270
|
+
];
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The command option property parser logic.
|
|
274
|
+
*/
|
|
275
|
+
function OptionsMemberParserLogic({ name, option }) {
|
|
276
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
277
|
+
const equalsRegex = `/^--?(${context?.config.isCaseSensitive && name.length > 1 ? name : name.toLowerCase()}${option.alias && option.alias.length > 0 ? "|" : ""}${option.alias?.map((a) => (context?.config.isCaseSensitive && name.length > 1 ? a : a.toLowerCase()) === "?" ? "\\?" : context?.config.isCaseSensitive && name.length > 1 ? a : a.toLowerCase()).join("|")})=/`;
|
|
278
|
+
return [
|
|
279
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
280
|
+
get when() {
|
|
281
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
282
|
+
},
|
|
283
|
+
get children() {
|
|
284
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
285
|
+
get when() {
|
|
286
|
+
return option.variadic;
|
|
287
|
+
},
|
|
288
|
+
get children() {
|
|
289
|
+
return [
|
|
290
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
291
|
+
get when() {
|
|
292
|
+
return name.includes("?") || name.includes("-");
|
|
293
|
+
},
|
|
294
|
+
fallback: __alloy_js_core.code`options.${name} ??= []; `,
|
|
295
|
+
children: __alloy_js_core.code`options["${name}"] ??= []; `
|
|
296
|
+
}),
|
|
297
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
298
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
299
|
+
condition: `${equalsRegex}.test(arg)`,
|
|
300
|
+
get children() {
|
|
301
|
+
return [
|
|
302
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
303
|
+
get when() {
|
|
304
|
+
return name.includes("?") || name.includes("-");
|
|
305
|
+
},
|
|
306
|
+
fallback: __alloy_js_core.code`options.${name}.push(`,
|
|
307
|
+
children: __alloy_js_core.code`options["${name}"].push(`
|
|
308
|
+
}),
|
|
309
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
310
|
+
get when() {
|
|
311
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
312
|
+
},
|
|
313
|
+
children: __alloy_js_core.code`...arg.replace(${equalsRegex}, "").split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean) `
|
|
314
|
+
}),
|
|
315
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
316
|
+
get when() {
|
|
317
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
318
|
+
},
|
|
319
|
+
children: __alloy_js_core.code`...arg.replace(${equalsRegex}, "").split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `
|
|
320
|
+
}),
|
|
321
|
+
__alloy_js_core.code`); `
|
|
322
|
+
];
|
|
323
|
+
}
|
|
324
|
+
}),
|
|
325
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
326
|
+
condition: `args.length > i + 1`,
|
|
327
|
+
get children() {
|
|
328
|
+
return [
|
|
329
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
330
|
+
get when() {
|
|
331
|
+
return name.includes("?") || name.includes("-");
|
|
332
|
+
},
|
|
333
|
+
fallback: __alloy_js_core.code`options.${name}.push(`,
|
|
334
|
+
children: __alloy_js_core.code`options["${name}"].push(`
|
|
335
|
+
}),
|
|
336
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
337
|
+
get when() {
|
|
338
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
339
|
+
},
|
|
340
|
+
children: __alloy_js_core.code`...args[++i].split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean) `
|
|
341
|
+
}),
|
|
342
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
343
|
+
get when() {
|
|
344
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
345
|
+
},
|
|
346
|
+
children: __alloy_js_core.code`...args[++i].split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `
|
|
347
|
+
}),
|
|
348
|
+
__alloy_js_core.code`); `
|
|
349
|
+
];
|
|
350
|
+
}
|
|
351
|
+
})
|
|
352
|
+
];
|
|
353
|
+
}
|
|
354
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
355
|
+
get when() {
|
|
356
|
+
return !option.variadic;
|
|
357
|
+
},
|
|
358
|
+
get children() {
|
|
359
|
+
return [
|
|
360
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
361
|
+
condition: `${equalsRegex}.test(arg)`,
|
|
362
|
+
get children() {
|
|
363
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
364
|
+
get when() {
|
|
365
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
366
|
+
},
|
|
367
|
+
get children() {
|
|
368
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
369
|
+
get when() {
|
|
370
|
+
return name.includes("?") || name.includes("-");
|
|
371
|
+
},
|
|
372
|
+
fallback: __alloy_js_core.code`options.${name}`,
|
|
373
|
+
children: __alloy_js_core.code`options["${name}"]`
|
|
374
|
+
}), __alloy_js_core.code` = arg.replace(${equalsRegex}, "").trim().replace(/^("|')/, "").replace(/("|')$/, ""); `];
|
|
375
|
+
}
|
|
376
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
377
|
+
get when() {
|
|
378
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
379
|
+
},
|
|
380
|
+
get children() {
|
|
381
|
+
return [
|
|
382
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
383
|
+
"const": true,
|
|
384
|
+
name: "value",
|
|
385
|
+
initializer: __alloy_js_core.code` Number(arg.replace(${equalsRegex}, "").trim().replace(/^("|')/, "").replace(/("|')$/, "")); `
|
|
386
|
+
}),
|
|
387
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
388
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
389
|
+
condition: `!Number.isNaN(value)`,
|
|
390
|
+
get children() {
|
|
391
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
392
|
+
get when() {
|
|
393
|
+
return name.includes("?") || name.includes("-");
|
|
394
|
+
},
|
|
395
|
+
fallback: __alloy_js_core.code`options.${name}`,
|
|
396
|
+
children: __alloy_js_core.code`options["${name}"]`
|
|
397
|
+
}), __alloy_js_core.code` = value; `];
|
|
398
|
+
}
|
|
399
|
+
}),
|
|
400
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseClause, { get children() {
|
|
401
|
+
return __alloy_js_core.code`warn(\`Invalid value provided for the ${option.title} option: "\${value}" is not a valid number.\`); `;
|
|
402
|
+
} })
|
|
403
|
+
];
|
|
404
|
+
}
|
|
405
|
+
})];
|
|
406
|
+
}
|
|
407
|
+
}),
|
|
408
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
409
|
+
condition: `args.length > i + 1`,
|
|
410
|
+
get children() {
|
|
411
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
412
|
+
get when() {
|
|
413
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
414
|
+
},
|
|
415
|
+
get children() {
|
|
416
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
417
|
+
get when() {
|
|
418
|
+
return name.includes("?") || name.includes("-");
|
|
419
|
+
},
|
|
420
|
+
fallback: __alloy_js_core.code`options.${name}`,
|
|
421
|
+
children: __alloy_js_core.code`options["${name}"]`
|
|
422
|
+
}), __alloy_js_core.code` = args[++i].trim().replace(/^("|')/, "").replace(/("|')$/, ""); `];
|
|
423
|
+
}
|
|
424
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
425
|
+
get when() {
|
|
426
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
427
|
+
},
|
|
428
|
+
get children() {
|
|
429
|
+
return [
|
|
430
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
431
|
+
"const": true,
|
|
432
|
+
name: "value",
|
|
433
|
+
initializer: __alloy_js_core.code` Number(args[++i].trim().replace(/^("|')/, "").replace(/("|')$/, "")); `
|
|
434
|
+
}),
|
|
435
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
436
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
437
|
+
condition: `!Number.isNaN(value)`,
|
|
438
|
+
get children() {
|
|
439
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
440
|
+
get when() {
|
|
441
|
+
return name.includes("?") || name.includes("-");
|
|
442
|
+
},
|
|
443
|
+
fallback: __alloy_js_core.code`options.${name}`,
|
|
444
|
+
children: __alloy_js_core.code`options["${name}"]`
|
|
445
|
+
}), __alloy_js_core.code` = value; `];
|
|
446
|
+
}
|
|
447
|
+
}),
|
|
448
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseClause, { get children() {
|
|
449
|
+
return __alloy_js_core.code`warn(\`Invalid value provided for the ${option.title} option: "\${value}" is not a valid number.\`); `;
|
|
450
|
+
} })
|
|
451
|
+
];
|
|
452
|
+
}
|
|
453
|
+
})];
|
|
454
|
+
}
|
|
455
|
+
}),
|
|
456
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
457
|
+
];
|
|
458
|
+
}
|
|
459
|
+
})];
|
|
460
|
+
}
|
|
461
|
+
}),
|
|
462
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
463
|
+
get when() {
|
|
464
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean;
|
|
465
|
+
},
|
|
466
|
+
get children() {
|
|
467
|
+
return [
|
|
468
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
469
|
+
condition: `${equalsRegex}.test(arg)`,
|
|
470
|
+
get children() {
|
|
471
|
+
return [
|
|
472
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
473
|
+
"const": true,
|
|
474
|
+
name: "value",
|
|
475
|
+
initializer: __alloy_js_core.code` arg.replace(${equalsRegex}, "").trim().replace(/^("|')/, "").replace(/("|')$/, "").toLowerCase(); `
|
|
476
|
+
}),
|
|
477
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
478
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
479
|
+
get when() {
|
|
480
|
+
return name.includes("?") || name.includes("-");
|
|
481
|
+
},
|
|
482
|
+
fallback: __alloy_js_core.code`options.${name}`,
|
|
483
|
+
children: __alloy_js_core.code`options["${name}"]`
|
|
484
|
+
}),
|
|
485
|
+
__alloy_js_core.code` = value !== "false" && value !== "f" && value !== "no" && value !== "n" && value !== "0"; `
|
|
486
|
+
];
|
|
487
|
+
}
|
|
488
|
+
}),
|
|
489
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseClause, { get children() {
|
|
490
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
491
|
+
get when() {
|
|
492
|
+
return name.includes("?") || name.includes("-");
|
|
493
|
+
},
|
|
494
|
+
fallback: __alloy_js_core.code`options.${name} = true; `,
|
|
495
|
+
children: __alloy_js_core.code`options["${name}"] = true; `
|
|
496
|
+
});
|
|
497
|
+
} }),
|
|
498
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
499
|
+
get when() {
|
|
500
|
+
return Boolean(option.isNegativeOf);
|
|
501
|
+
},
|
|
502
|
+
get children() {
|
|
503
|
+
return [(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
504
|
+
get when() {
|
|
505
|
+
return option.isNegativeOf.includes("?") || option.isNegativeOf.includes("-");
|
|
506
|
+
},
|
|
507
|
+
get fallback() {
|
|
508
|
+
return __alloy_js_core.code`options.${option.isNegativeOf} = false; `;
|
|
509
|
+
},
|
|
510
|
+
get children() {
|
|
511
|
+
return __alloy_js_core.code`options["${option.isNegativeOf}"] = false; `;
|
|
512
|
+
}
|
|
513
|
+
})];
|
|
514
|
+
}
|
|
515
|
+
})
|
|
516
|
+
];
|
|
517
|
+
}
|
|
518
|
+
}),
|
|
519
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
520
|
+
get when() {
|
|
521
|
+
return option.alias && option.alias.length > 0;
|
|
522
|
+
},
|
|
523
|
+
get children() {
|
|
524
|
+
return [(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
525
|
+
get each() {
|
|
526
|
+
return option.alias ?? [];
|
|
527
|
+
},
|
|
528
|
+
hardline: true,
|
|
529
|
+
children: (alias) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
530
|
+
get when() {
|
|
531
|
+
return alias.includes("?") || alias.includes("-");
|
|
532
|
+
},
|
|
533
|
+
fallback: __alloy_js_core.code`options.${alias} `,
|
|
534
|
+
children: __alloy_js_core.code`options["${alias}"] `
|
|
535
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
536
|
+
get when() {
|
|
537
|
+
return name.includes("?") || name.includes("-");
|
|
538
|
+
},
|
|
539
|
+
fallback: __alloy_js_core.code` = options.${name}; `,
|
|
540
|
+
children: __alloy_js_core.code` = options["${name}"]; `
|
|
541
|
+
})]
|
|
542
|
+
})];
|
|
543
|
+
}
|
|
544
|
+
})
|
|
545
|
+
];
|
|
546
|
+
}
|
|
547
|
+
function OptionsMemberParserCondition(props) {
|
|
548
|
+
const { name, alias } = props;
|
|
549
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
550
|
+
return [(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`arg.startsWith("--${context?.config.isCaseSensitive ? name : name.toLowerCase()}=") || arg === "--${context?.config.isCaseSensitive ? name : name.toLowerCase()}" || arg.startsWith("-${name}=") || arg === "-${name}"`), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
551
|
+
get when() {
|
|
552
|
+
return alias && alias.length > 0;
|
|
553
|
+
},
|
|
554
|
+
get children() {
|
|
555
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
556
|
+
each: alias ?? [],
|
|
557
|
+
children: (a) => __alloy_js_core.code` || arg.startsWith("--${context?.config.isCaseSensitive ? a : a.toLowerCase()}=") || arg === "--${context?.config.isCaseSensitive ? a : a.toLowerCase()}" || arg.startsWith("-${a}=") || arg === "-${a}"`
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
})];
|
|
561
|
+
}
|
|
562
|
+
function OptionsInterfaceDeclaration(props) {
|
|
563
|
+
const { command } = props;
|
|
564
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceDeclaration, {
|
|
565
|
+
"export": true,
|
|
566
|
+
get name() {
|
|
567
|
+
return `${(0, __stryke_string_format_pascal_case.pascalCase)(command.name)}Options`;
|
|
568
|
+
},
|
|
569
|
+
get children() {
|
|
570
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
571
|
+
get each() {
|
|
572
|
+
return Object.entries(command.options);
|
|
573
|
+
},
|
|
574
|
+
children: ([name, option]) => (0, __alloy_js_core_jsx_runtime.createComponent)(OptionsMember, {
|
|
575
|
+
name,
|
|
576
|
+
option
|
|
577
|
+
})
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* The command options parser logic.
|
|
584
|
+
*/
|
|
585
|
+
function OptionsParserLogic(props) {
|
|
586
|
+
const { command } = props;
|
|
587
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
588
|
+
return [
|
|
589
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
590
|
+
"const": true,
|
|
591
|
+
name: "options",
|
|
592
|
+
get initializer() {
|
|
593
|
+
return __alloy_js_core.code` {
|
|
594
|
+
${Object.entries(command.options).map(([name, option]) => {
|
|
595
|
+
if (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${context.config.envPrefix}_${option.env}` : ""}${option.variadic ? option.default !== void 0 ? `${option.env ? " ?? " : ""}${JSON.stringify(option.default)}` : option.env ? " ?? []" : "" : option.default !== void 0 ? `${option.env ? " ?? " : ""}"${option.default}"` : ""}, `;
|
|
596
|
+
else if (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${context.config.envPrefix}_${option.env}` : ""}${option.variadic ? option.default !== void 0 ? `${option.env ? " ?? " : ""}${JSON.stringify(option.default)}` : option.env ? " ?? []" : "" : option.default !== void 0 ? `${option.env ? " ?? " : ""}${option.default}` : ""}, `;
|
|
597
|
+
else if (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${context.config.envPrefix}_${option.env} ?? ` : ""}${option.default ? "true" : "false"},`;
|
|
598
|
+
return "";
|
|
599
|
+
}).join("")}
|
|
600
|
+
} as ${(0, __stryke_string_format_pascal_case.pascalCase)(command.name)}Options;`;
|
|
601
|
+
}
|
|
602
|
+
}),
|
|
603
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
604
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
605
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`for (let i = 0; i < args.slice(${command.path.segments.filter((segment) => (0, __shell_shock_core_plugin_utils_context_helpers.isVariableCommandPath)(segment)).length}).length; i++) { `),
|
|
606
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
607
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
608
|
+
"const": true,
|
|
609
|
+
name: "arg",
|
|
610
|
+
type: "string",
|
|
611
|
+
get initializer() {
|
|
612
|
+
return __alloy_js_core.code` args[i].length > 3 && args[i].startsWith("--")
|
|
613
|
+
? \`--\${args[i].slice(2).replaceAll("-", "")${context?.config.isCaseSensitive ? "" : ".toLowerCase()"}}\`
|
|
614
|
+
: args[i].length > 2 && args[i].startsWith("-")
|
|
615
|
+
? \`-\${args[i].slice(1).replaceAll("-", "")}\`
|
|
616
|
+
: args[i]; `;
|
|
617
|
+
}
|
|
618
|
+
}),
|
|
619
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
620
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
621
|
+
get each() {
|
|
622
|
+
return Object.entries(command.options);
|
|
623
|
+
},
|
|
624
|
+
hardline: true,
|
|
625
|
+
children: ([name, option], i) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
626
|
+
when: i === 0,
|
|
627
|
+
get fallback() {
|
|
628
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
629
|
+
get condition() {
|
|
630
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserCondition, {
|
|
631
|
+
name,
|
|
632
|
+
get alias() {
|
|
633
|
+
return option.alias;
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
},
|
|
637
|
+
get children() {
|
|
638
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserLogic, {
|
|
639
|
+
name,
|
|
640
|
+
option
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
},
|
|
645
|
+
get children() {
|
|
646
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
647
|
+
get condition() {
|
|
648
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserCondition, {
|
|
649
|
+
name,
|
|
650
|
+
get alias() {
|
|
651
|
+
return option.alias;
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
},
|
|
655
|
+
get children() {
|
|
656
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserLogic, {
|
|
657
|
+
name,
|
|
658
|
+
option
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
})
|
|
664
|
+
}),
|
|
665
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
666
|
+
__alloy_js_core.code` } `,
|
|
667
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
668
|
+
];
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
//#endregion
|
|
672
|
+
exports.OptionsInterfaceDeclaration = OptionsInterfaceDeclaration;
|
|
673
|
+
exports.OptionsMember = OptionsMember;
|
|
674
|
+
exports.OptionsMemberParserLogic = OptionsMemberParserLogic;
|
|
675
|
+
exports.OptionsParserLogic = OptionsParserLogic;
|
|
676
|
+
exports.ParamsParserLogic = ParamsParserLogic;
|
|
677
|
+
exports.VariablePathsParserLogic = VariablePathsParserLogic;
|
|
678
|
+
//# sourceMappingURL=args-parser-logic.cjs.map
|