@shell-shock/core 0.17.5 → 0.17.7
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/command-validation-logic.cjs +214 -152
- package/dist/components/command-validation-logic.mjs +213 -152
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +113 -9
- package/dist/components/docs.mjs +109 -9
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/exec-builtin.cjs +36 -1
- package/dist/components/exec-builtin.d.cts.map +1 -1
- package/dist/components/exec-builtin.d.mts.map +1 -1
- package/dist/components/exec-builtin.mjs +35 -1
- package/dist/components/exec-builtin.mjs.map +1 -1
- package/dist/components/helpers.cjs +51 -2
- package/dist/components/helpers.mjs +50 -2
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/index.cjs +17 -1
- package/dist/components/index.mjs +9 -9
- package/dist/components/options-parser-logic.cjs +411 -174
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +405 -174
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/state-builtin.cjs +61 -5
- package/dist/components/state-builtin.mjs +60 -5
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/usage.cjs +46 -3
- package/dist/components/usage.mjs +45 -3
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +68 -3
- package/dist/components/utils-builtin.mjs +67 -3
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/helpers/automd.cjs +28 -13
- package/dist/helpers/automd.mjs +28 -13
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/index.cjs +11 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/plugin-utils/compute-bin.cjs +50 -0
- package/dist/plugin-utils/compute-bin.d.cts +13 -0
- package/dist/plugin-utils/compute-bin.d.cts.map +1 -0
- package/dist/plugin-utils/compute-bin.d.mts +13 -0
- package/dist/plugin-utils/compute-bin.d.mts.map +1 -0
- package/dist/plugin-utils/compute-bin.mjs +50 -0
- package/dist/plugin-utils/compute-bin.mjs.map +1 -0
- package/dist/plugin-utils/get-command-tree.cjs +50 -0
- package/dist/plugin-utils/get-command-tree.d.cts +15 -1
- package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.mts +15 -1
- package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/get-command-tree.mjs +49 -1
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +4 -0
- package/dist/plugin-utils/index.d.cts +3 -2
- package/dist/plugin-utils/index.d.mts +3 -2
- package/dist/plugin-utils/index.mjs +3 -2
- package/dist/plugin.cjs +170 -52
- package/dist/plugin.mjs +170 -52
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +1 -1
- package/dist/resolver/deepkit.mjs +1 -1
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/dist/types/command.cjs +120 -10
- package/dist/types/command.d.cts +95 -8
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts +95 -8
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs +109 -10
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/index.cjs +12 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +2 -2
- package/package.json +10 -10
|
@@ -14,39 +14,76 @@ let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
|
14
14
|
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
15
15
|
|
|
16
16
|
//#region src/components/options-parser-logic.tsx
|
|
17
|
+
function __assignType(fn, args) {
|
|
18
|
+
fn.__type = args;
|
|
19
|
+
return fn;
|
|
20
|
+
}
|
|
21
|
+
const __ΩDynamicSegmentsParserLogicProps = [
|
|
22
|
+
"CommandTree",
|
|
23
|
+
"command",
|
|
24
|
+
"The command to generate the dynamic path segments parser logic for. This is used to access the command options and parameters when generating the parser logic for dynamic path segments.",
|
|
25
|
+
"isCaseSensitive",
|
|
26
|
+
"Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.",
|
|
27
|
+
"DynamicSegmentsParserLogicProps",
|
|
28
|
+
"P\"w!4\"?#)4$?%Mw&y"
|
|
29
|
+
];
|
|
17
30
|
function DynamicSegmentsParserLogic(props) {
|
|
18
31
|
const { command } = props;
|
|
19
32
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
20
33
|
get each() {
|
|
21
34
|
return command.segments ?? [];
|
|
22
35
|
},
|
|
23
|
-
children
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
get children() {
|
|
37
|
+
return __assignType((segment, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
38
|
+
get when() {
|
|
39
|
+
return require_context_helpers.isDynamicPathSegment(segment);
|
|
40
|
+
},
|
|
41
|
+
get children() {
|
|
42
|
+
return [
|
|
43
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
44
|
+
"let": true,
|
|
45
|
+
get name() {
|
|
46
|
+
return (0, _stryke_string_format_camel_case.camelCase)(require_context_helpers.getDynamicPathSegmentName(segment));
|
|
47
|
+
},
|
|
48
|
+
type: "string | undefined"
|
|
49
|
+
}),
|
|
50
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
51
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
52
|
+
condition: _alloy_js_core.code`args.length > ${2 + index} && args[${2 + index}]`,
|
|
53
|
+
get children() {
|
|
54
|
+
return _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(require_context_helpers.getDynamicPathSegmentName(segment))} = args[${2 + index}];`;
|
|
55
|
+
}
|
|
56
|
+
}),
|
|
57
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
58
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
}), [
|
|
62
|
+
"segment",
|
|
63
|
+
"index",
|
|
64
|
+
"",
|
|
65
|
+
"P\"2!\"2\"\"/#"
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
48
68
|
});
|
|
49
69
|
}
|
|
70
|
+
DynamicSegmentsParserLogic.__type = [
|
|
71
|
+
() => __ΩDynamicSegmentsParserLogicProps,
|
|
72
|
+
"props",
|
|
73
|
+
"DynamicSegmentsParserLogic",
|
|
74
|
+
"Pn!2\"\"/#"
|
|
75
|
+
];
|
|
76
|
+
const __ΩArgumentsParserLogicProps = [
|
|
77
|
+
"CommandTree",
|
|
78
|
+
"command",
|
|
79
|
+
"The command to generate the positional parameters parser logic for.",
|
|
80
|
+
"appSpecificEnvPrefix",
|
|
81
|
+
"The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).",
|
|
82
|
+
"isCaseSensitive",
|
|
83
|
+
"Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.",
|
|
84
|
+
"ArgumentsParserLogicProps",
|
|
85
|
+
"P\"w!4\"?#&4$?%)4&?'Mw(y"
|
|
86
|
+
];
|
|
50
87
|
function ArgumentsParserLogic(props) {
|
|
51
88
|
const { command, appSpecificEnvPrefix, isCaseSensitive } = props;
|
|
52
89
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
@@ -60,7 +97,15 @@ function ArgumentsParserLogic(props) {
|
|
|
60
97
|
name: "optionsIndex",
|
|
61
98
|
type: "number",
|
|
62
99
|
get initializer() {
|
|
63
|
-
return _alloy_js_core.code`Math.max(0, args.slice(${command.segments.length + 1}).findIndex(arg => arg.startsWith("-") && /^(${Object.values(command.options ?? {}).map((option) => `${isCaseSensitive || option.name.length === 1 ? option.name : option.name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}${option.alias && option.alias.length > 0 ? "|" : ""}${option.alias?.map((a) => (isCaseSensitive || option.name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")) === "?" ? "\\?" : isCaseSensitive || option.name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")
|
|
100
|
+
return _alloy_js_core.code`Math.max(0, args.slice(${command.segments.length + 1}).findIndex(arg => arg.startsWith("-") && /^(${Object.values(command.options ?? {}).map(__assignType((option) => `${isCaseSensitive || option.name.length === 1 ? option.name : option.name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}${option.alias && option.alias.length > 0 ? "|" : ""}${option.alias?.map(__assignType((a) => (isCaseSensitive || option.name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")) === "?" ? "\\?" : isCaseSensitive || option.name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", ""), [
|
|
101
|
+
"a",
|
|
102
|
+
"",
|
|
103
|
+
"P\"2!\"/\""
|
|
104
|
+
])).join("|")}`, [
|
|
105
|
+
"option",
|
|
106
|
+
"",
|
|
107
|
+
"P\"2!\"/\""
|
|
108
|
+
])).join("|")})=?.*$/.test(arg${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"}))) + ${command.segments.length + 1};`;
|
|
64
109
|
}
|
|
65
110
|
}),
|
|
66
111
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -69,7 +114,15 @@ function ArgumentsParserLogic(props) {
|
|
|
69
114
|
name: "argsIndex",
|
|
70
115
|
type: "number",
|
|
71
116
|
get initializer() {
|
|
72
|
-
return _alloy_js_core.code`optionsIndex > ${command.segments.length + 1} ? ${command.segments.length + 1} : (Math.max(0, args.slice(optionsIndex).findLastIndex(arg => arg.startsWith("-") && /^(${Object.values(command.options ?? {}).map((option) => `${isCaseSensitive || option.name.length === 1 ? option.name : option.name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}${option.alias && option.alias.length > 0 ? "|" : ""}${option.alias?.map((a) => (isCaseSensitive || option.name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")) === "?" ? "\\?" : isCaseSensitive || option.name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")
|
|
117
|
+
return _alloy_js_core.code`optionsIndex > ${command.segments.length + 1} ? ${command.segments.length + 1} : (Math.max(0, args.slice(optionsIndex).findLastIndex(arg => arg.startsWith("-") && /^(${Object.values(command.options ?? {}).map(__assignType((option) => `${isCaseSensitive || option.name.length === 1 ? option.name : option.name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}${option.alias && option.alias.length > 0 ? "|" : ""}${option.alias?.map(__assignType((a) => (isCaseSensitive || option.name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")) === "?" ? "\\?" : isCaseSensitive || option.name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", ""), [
|
|
118
|
+
"a",
|
|
119
|
+
"",
|
|
120
|
+
"P\"2!\"/\""
|
|
121
|
+
])).join("|")}`, [
|
|
122
|
+
"option",
|
|
123
|
+
"",
|
|
124
|
+
"P\"2!\"/\""
|
|
125
|
+
])).join("|")})=?.*$/.test(arg${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"}))) + ${command.segments.length + 1});`;
|
|
73
126
|
}
|
|
74
127
|
}),
|
|
75
128
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -78,103 +131,136 @@ function ArgumentsParserLogic(props) {
|
|
|
78
131
|
return command.args ?? [];
|
|
79
132
|
},
|
|
80
133
|
hardline: true,
|
|
81
|
-
children
|
|
82
|
-
(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
get type() {
|
|
100
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg });
|
|
101
|
-
},
|
|
102
|
-
get initializer() {
|
|
103
|
-
return [
|
|
104
|
-
_alloy_js_core.code` ( `,
|
|
105
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
106
|
-
get when() {
|
|
107
|
-
return (0, _stryke_type_checks_is_set_string.isSetString)(arg.env);
|
|
108
|
-
},
|
|
109
|
-
get children() {
|
|
110
|
-
return _alloy_js_core.code`env.${appSpecificEnvPrefix}_${(0, _stryke_string_format_constant_case.constantCase)(String(arg.env))} ?? `;
|
|
111
|
-
}
|
|
112
|
-
}),
|
|
113
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
114
|
-
get when() {
|
|
115
|
-
return arg.default !== void 0;
|
|
116
|
-
},
|
|
117
|
-
get fallback() {
|
|
118
|
-
return arg.variadic ? _alloy_js_core.code`[]` : _alloy_js_core.code`undefined`;
|
|
119
|
-
},
|
|
120
|
-
get children() {
|
|
121
|
-
return arg.kind === require_types_command.CommandParameterKinds.string ? _alloy_js_core.code`"${arg.default}"` : _alloy_js_core.code`${arg.default}`;
|
|
122
|
-
}
|
|
123
|
-
}),
|
|
124
|
-
_alloy_js_core.code`) as `,
|
|
125
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg }),
|
|
126
|
-
_alloy_js_core.code`; `
|
|
127
|
-
];
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}),
|
|
132
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
133
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
134
|
-
condition: _alloy_js_core.code`argsIndex + ${index} < args.length && argsIndex + ${index} !== optionsIndex`,
|
|
135
|
-
get children() {
|
|
136
|
-
return [
|
|
137
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = `),
|
|
138
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
139
|
-
get when() {
|
|
140
|
-
return arg.kind === require_types_command.CommandParameterKinds.string || arg.kind === require_types_command.CommandParameterKinds.number;
|
|
134
|
+
get children() {
|
|
135
|
+
return __assignType((arg, index) => [
|
|
136
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
137
|
+
get when() {
|
|
138
|
+
return (0, _stryke_type_checks_is_set_string.isSetString)(arg.env) || arg.default !== void 0 || arg.variadic;
|
|
139
|
+
},
|
|
140
|
+
get fallback() {
|
|
141
|
+
return [
|
|
142
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`let ${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}!: `),
|
|
143
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg }),
|
|
144
|
+
_alloy_js_core.code`; `
|
|
145
|
+
];
|
|
146
|
+
},
|
|
147
|
+
get children() {
|
|
148
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
149
|
+
"let": true,
|
|
150
|
+
get name() {
|
|
151
|
+
return (0, _stryke_string_format_camel_case.camelCase)(arg.name);
|
|
141
152
|
},
|
|
142
|
-
get
|
|
143
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.
|
|
153
|
+
get type() {
|
|
154
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg });
|
|
144
155
|
},
|
|
145
|
-
get
|
|
146
|
-
return
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
156
|
+
get initializer() {
|
|
157
|
+
return [
|
|
158
|
+
_alloy_js_core.code` ( `,
|
|
159
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
160
|
+
get when() {
|
|
161
|
+
return (0, _stryke_type_checks_is_set_string.isSetString)(arg.env);
|
|
162
|
+
},
|
|
163
|
+
get children() {
|
|
164
|
+
return _alloy_js_core.code`env.${appSpecificEnvPrefix}_${(0, _stryke_string_format_constant_case.constantCase)(String(arg.env))} ?? `;
|
|
165
|
+
}
|
|
166
|
+
}),
|
|
167
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
168
|
+
get when() {
|
|
169
|
+
return arg.default !== void 0 && (!arg.variadic || arg.default.length > 0);
|
|
170
|
+
},
|
|
171
|
+
get fallback() {
|
|
172
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
173
|
+
get when() {
|
|
174
|
+
return arg.variadic;
|
|
175
|
+
},
|
|
176
|
+
fallback: _alloy_js_core.code`undefined`,
|
|
177
|
+
children: _alloy_js_core.code`[]`
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
get children() {
|
|
181
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
182
|
+
get when() {
|
|
183
|
+
return arg.variadic;
|
|
184
|
+
},
|
|
185
|
+
get fallback() {
|
|
186
|
+
return arg.kind === require_types_command.CommandParameterKinds.string ? _alloy_js_core.code`"${arg.default}"` : _alloy_js_core.code`${arg.default}`;
|
|
187
|
+
},
|
|
188
|
+
get children() {
|
|
189
|
+
return _alloy_js_core.code`[${arg.default?.map(__assignType((value) => arg.kind === require_types_command.CommandParameterKinds.string ? `"${value}"` : value, [
|
|
190
|
+
"value",
|
|
191
|
+
"",
|
|
192
|
+
"P\"2!\"/\""
|
|
193
|
+
])).join(", ")}]`;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}),
|
|
198
|
+
_alloy_js_core.code`) as `,
|
|
199
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg }),
|
|
200
|
+
_alloy_js_core.code`; `
|
|
201
|
+
];
|
|
163
202
|
}
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}),
|
|
206
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
207
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
208
|
+
condition: _alloy_js_core.code`argsIndex + ${index} < args.length && argsIndex + ${index} !== optionsIndex`,
|
|
209
|
+
get children() {
|
|
210
|
+
return [
|
|
211
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = `),
|
|
212
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
213
|
+
get when() {
|
|
214
|
+
return arg.kind === require_types_command.CommandParameterKinds.string || arg.kind === require_types_command.CommandParameterKinds.number;
|
|
215
|
+
},
|
|
216
|
+
get fallback() {
|
|
217
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.BooleanInputParserLogic, { name: `args[argsIndex + ${index}] ` });
|
|
218
|
+
},
|
|
219
|
+
get children() {
|
|
220
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
221
|
+
get when() {
|
|
222
|
+
return arg.variadic;
|
|
223
|
+
},
|
|
224
|
+
get fallback() {
|
|
225
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
226
|
+
get when() {
|
|
227
|
+
return arg.kind === require_types_command.CommandParameterKinds.number;
|
|
228
|
+
},
|
|
229
|
+
fallback: _alloy_js_core.code`args[argsIndex + ${index}] `,
|
|
230
|
+
children: _alloy_js_core.code`Number(args[argsIndex + ${index}]) `
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
get children() {
|
|
234
|
+
return _alloy_js_core.code`args.slice(argsIndex + ${index}, (optionsIndex > argsIndex ? optionsIndex : args.length) - ${command.args.length - index}).join(" ").split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean)`;
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}),
|
|
239
|
+
_alloy_js_core.code` as `,
|
|
240
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg }),
|
|
241
|
+
_alloy_js_core.code`; `
|
|
242
|
+
];
|
|
243
|
+
}
|
|
244
|
+
}),
|
|
245
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
246
|
+
], [
|
|
247
|
+
"arg",
|
|
248
|
+
"index",
|
|
249
|
+
"",
|
|
250
|
+
"P\"2!\"2\"\"/#"
|
|
251
|
+
]);
|
|
252
|
+
}
|
|
173
253
|
})
|
|
174
254
|
];
|
|
175
255
|
}
|
|
176
256
|
});
|
|
177
257
|
}
|
|
258
|
+
ArgumentsParserLogic.__type = [
|
|
259
|
+
() => __ΩArgumentsParserLogicProps,
|
|
260
|
+
"props",
|
|
261
|
+
"ArgumentsParserLogic",
|
|
262
|
+
"Pn!2\"\"/#"
|
|
263
|
+
];
|
|
178
264
|
/**
|
|
179
265
|
* The command option interface property.
|
|
180
266
|
*/
|
|
@@ -247,12 +333,36 @@ function OptionsMember({ option }) {
|
|
|
247
333
|
}
|
|
248
334
|
})];
|
|
249
335
|
}
|
|
336
|
+
OptionsMember.__type = [
|
|
337
|
+
"CommandOption",
|
|
338
|
+
"option",
|
|
339
|
+
"param0",
|
|
340
|
+
"OptionsMember",
|
|
341
|
+
"The command option interface property.",
|
|
342
|
+
"PP\"w!4\"M2#\"/$?%"
|
|
343
|
+
];
|
|
344
|
+
const __ΩOptionsMemberParserLogicProps = [
|
|
345
|
+
"name",
|
|
346
|
+
"The option name to generate the parser logic for.",
|
|
347
|
+
"CommandOption",
|
|
348
|
+
"option",
|
|
349
|
+
"The command option to generate the parser logic for.",
|
|
350
|
+
"isCaseSensitive",
|
|
351
|
+
true,
|
|
352
|
+
"Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.",
|
|
353
|
+
"OptionsMemberParserLogicProps",
|
|
354
|
+
"P&4!?\"\"w#4$?%)4&>'?(Mw)y"
|
|
355
|
+
];
|
|
250
356
|
/**
|
|
251
357
|
* The command option property parser logic.
|
|
252
358
|
*/
|
|
253
359
|
function OptionsMemberParserLogic(props) {
|
|
254
360
|
const { name, option, isCaseSensitive } = props;
|
|
255
|
-
const equalsRegex = `/^--?(${isCaseSensitive || name.length === 1 ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}${option.alias && option.alias.length > 0 ? "|" : ""}${option.alias?.map((a) => (isCaseSensitive || name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")) === "?" ? "\\?" : isCaseSensitive || name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")
|
|
361
|
+
const equalsRegex = `/^--?(${isCaseSensitive || name.length === 1 ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}${option.alias && option.alias.length > 0 ? "|" : ""}${option.alias?.map(__assignType((a) => (isCaseSensitive || name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")) === "?" ? "\\?" : isCaseSensitive || name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", ""), [
|
|
362
|
+
"a",
|
|
363
|
+
"",
|
|
364
|
+
"P\"2!\"/\""
|
|
365
|
+
])).join("|")})=/`;
|
|
256
366
|
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
257
367
|
get when() {
|
|
258
368
|
return option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number;
|
|
@@ -300,7 +410,11 @@ function OptionsMemberParserLogic(props) {
|
|
|
300
410
|
return (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.choices && option.choices.length > 0;
|
|
301
411
|
},
|
|
302
412
|
get children() {
|
|
303
|
-
return _alloy_js_core.code` as ${option.choices?.map((choice) => (0, _stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice
|
|
413
|
+
return _alloy_js_core.code` as ${option.choices?.map(__assignType((choice) => (0, _stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice, [
|
|
414
|
+
"choice",
|
|
415
|
+
"",
|
|
416
|
+
"P\"2!\"/\""
|
|
417
|
+
])).join(" | ")} `;
|
|
304
418
|
}
|
|
305
419
|
}),
|
|
306
420
|
_alloy_js_core.code`); `
|
|
@@ -335,7 +449,11 @@ function OptionsMemberParserLogic(props) {
|
|
|
335
449
|
return (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.choices && option.choices.length > 0;
|
|
336
450
|
},
|
|
337
451
|
get children() {
|
|
338
|
-
return _alloy_js_core.code` as ${option.choices?.map((choice) => (0, _stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice
|
|
452
|
+
return _alloy_js_core.code` as ${option.choices?.map(__assignType((choice) => (0, _stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice, [
|
|
453
|
+
"choice",
|
|
454
|
+
"",
|
|
455
|
+
"P\"2!\"/\""
|
|
456
|
+
])).join(" | ")} `;
|
|
339
457
|
}
|
|
340
458
|
}),
|
|
341
459
|
_alloy_js_core.code`); `
|
|
@@ -372,7 +490,11 @@ function OptionsMemberParserLogic(props) {
|
|
|
372
490
|
return option.choices && option.choices.length > 0;
|
|
373
491
|
},
|
|
374
492
|
get children() {
|
|
375
|
-
return _alloy_js_core.code` as ${option.choices?.map((choice) => `"${choice}"
|
|
493
|
+
return _alloy_js_core.code` as ${option.choices?.map(__assignType((choice) => `"${choice}"`, [
|
|
494
|
+
"choice",
|
|
495
|
+
"",
|
|
496
|
+
"P\"2!\"/\""
|
|
497
|
+
])).join(" | ")}`;
|
|
376
498
|
}
|
|
377
499
|
}),
|
|
378
500
|
_alloy_js_core.code`; `
|
|
@@ -441,7 +563,11 @@ function OptionsMemberParserLogic(props) {
|
|
|
441
563
|
return option.choices && option.choices.length > 0;
|
|
442
564
|
},
|
|
443
565
|
get children() {
|
|
444
|
-
return _alloy_js_core.code` as ${option.choices?.map((choice) => `"${choice}"
|
|
566
|
+
return _alloy_js_core.code` as ${option.choices?.map(__assignType((choice) => `"${choice}"`, [
|
|
567
|
+
"choice",
|
|
568
|
+
"",
|
|
569
|
+
"P\"2!\"/\""
|
|
570
|
+
])).join(" | ")}`;
|
|
445
571
|
}
|
|
446
572
|
}),
|
|
447
573
|
_alloy_js_core.code`; `
|
|
@@ -551,6 +677,24 @@ function OptionsMemberParserLogic(props) {
|
|
|
551
677
|
}
|
|
552
678
|
})];
|
|
553
679
|
}
|
|
680
|
+
OptionsMemberParserLogic.__type = [
|
|
681
|
+
() => __ΩOptionsMemberParserLogicProps,
|
|
682
|
+
"props",
|
|
683
|
+
"OptionsMemberParserLogic",
|
|
684
|
+
"The command option property parser logic.",
|
|
685
|
+
"Pn!2\"\"/#?$"
|
|
686
|
+
];
|
|
687
|
+
const __ΩOptionsMemberParserConditionProps = [
|
|
688
|
+
"name",
|
|
689
|
+
"The option name to generate the parser logic for.",
|
|
690
|
+
"alias",
|
|
691
|
+
"Aliases for the option, which will also be parsed in the generated code. This will affect how the generated code compares command-line arguments to option names and aliases.",
|
|
692
|
+
"isCaseSensitive",
|
|
693
|
+
true,
|
|
694
|
+
"Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.",
|
|
695
|
+
"OptionsMemberParserConditionProps",
|
|
696
|
+
"P&4!?\"&F4#8?$)4%>&?'Mw(y"
|
|
697
|
+
];
|
|
554
698
|
function OptionsMemberParserCondition(props) {
|
|
555
699
|
const { name, alias: aliasProp, isCaseSensitive } = props;
|
|
556
700
|
return [(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${isCaseSensitive ? "arg.startsWith(\"--" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}" || ${isCaseSensitive ? "arg.startsWith(\"-" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}"`), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
@@ -560,17 +704,33 @@ function OptionsMemberParserCondition(props) {
|
|
|
560
704
|
get children() {
|
|
561
705
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
562
706
|
each: aliasProp ?? [],
|
|
563
|
-
children
|
|
707
|
+
get children() {
|
|
708
|
+
return __assignType((alias) => _alloy_js_core.code` || ${isCaseSensitive || alias.length === 1 ? "arg.startsWith(\"--" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive || alias.length === 1 ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}" || ${isCaseSensitive || alias.length === 1 ? "arg.startsWith(\"-" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive || alias.length === 1 ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}"`, [
|
|
709
|
+
"alias",
|
|
710
|
+
"",
|
|
711
|
+
"P\"2!\"/\""
|
|
712
|
+
]);
|
|
713
|
+
}
|
|
564
714
|
});
|
|
565
715
|
}
|
|
566
716
|
})];
|
|
567
717
|
}
|
|
718
|
+
OptionsMemberParserCondition.__type = [
|
|
719
|
+
() => __ΩOptionsMemberParserConditionProps,
|
|
720
|
+
"props",
|
|
721
|
+
"OptionsMemberParserCondition",
|
|
722
|
+
"Pn!2\"\"/#"
|
|
723
|
+
];
|
|
568
724
|
function OptionsInterfaceDeclaration(props) {
|
|
569
725
|
const { command } = props;
|
|
570
|
-
const options = (0, _alloy_js_core.computed)(() => require_contexts_options.computedOptions(Object.entries(command.options).map(([name, option]) => ({
|
|
726
|
+
const options = (0, _alloy_js_core.computed)(() => require_contexts_options.computedOptions(Object.entries(command.options).map(__assignType(([name, option]) => ({
|
|
571
727
|
...option,
|
|
572
728
|
name
|
|
573
|
-
})
|
|
729
|
+
}), [
|
|
730
|
+
"param0",
|
|
731
|
+
"",
|
|
732
|
+
"P\"2!\"/\""
|
|
733
|
+
]))));
|
|
574
734
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
575
735
|
"export": true,
|
|
576
736
|
get name() {
|
|
@@ -583,37 +743,75 @@ function OptionsInterfaceDeclaration(props) {
|
|
|
583
743
|
return Object.values(options.value);
|
|
584
744
|
},
|
|
585
745
|
hardline: true,
|
|
586
|
-
children
|
|
746
|
+
get children() {
|
|
747
|
+
return __assignType((option) => (0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMember, { option }), [
|
|
748
|
+
"option",
|
|
749
|
+
"",
|
|
750
|
+
"P\"2!\"/\""
|
|
751
|
+
]);
|
|
752
|
+
}
|
|
587
753
|
});
|
|
588
754
|
}
|
|
589
755
|
});
|
|
590
756
|
}
|
|
757
|
+
OptionsInterfaceDeclaration.__type = [
|
|
758
|
+
"CommandTree",
|
|
759
|
+
"command",
|
|
760
|
+
"props",
|
|
761
|
+
"OptionsInterfaceDeclaration",
|
|
762
|
+
"PP\"w!4\"M2#\"/$"
|
|
763
|
+
];
|
|
764
|
+
const __ΩOptionsParserLogicProps = [
|
|
765
|
+
"appSpecificEnvPrefix",
|
|
766
|
+
"The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).",
|
|
767
|
+
"isCaseSensitive",
|
|
768
|
+
true,
|
|
769
|
+
"Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.",
|
|
770
|
+
"OptionsParserLogicProps",
|
|
771
|
+
"P!&4!?\")4#8>$?%Mw&y"
|
|
772
|
+
];
|
|
591
773
|
/**
|
|
592
774
|
* The command options parser logic.
|
|
593
775
|
*/
|
|
594
776
|
function OptionsParserLogic(props) {
|
|
595
777
|
const { segments = [], options: _options, name: _name, appSpecificEnvPrefix, isCaseSensitive = false } = props;
|
|
596
|
-
const options = (0, _alloy_js_core.computed)(() => require_contexts_options.computedOptions(Object.entries(_options).map(([name, option]) => ({
|
|
778
|
+
const options = (0, _alloy_js_core.computed)(() => require_contexts_options.computedOptions(Object.entries(_options).map(__assignType(([name, option]) => ({
|
|
597
779
|
...option,
|
|
598
780
|
name
|
|
599
|
-
})
|
|
781
|
+
}), [
|
|
782
|
+
"param0",
|
|
783
|
+
"",
|
|
784
|
+
"P\"2!\"/\""
|
|
785
|
+
]))));
|
|
600
786
|
return [
|
|
601
787
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
602
788
|
"const": true,
|
|
603
789
|
name: "options",
|
|
604
790
|
get initializer() {
|
|
605
791
|
return _alloy_js_core.code` {
|
|
606
|
-
${segments.length > 0 ? "...useGlobalOptions(), " : ""}${Object.entries(options.value).filter(([, option]) => option.env || option.default !== void 0 || (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.variadic
|
|
792
|
+
${segments.length > 0 ? "...useGlobalOptions(), " : ""}${Object.entries(options.value).filter(__assignType(([, option]) => option.env || option.default !== void 0 || (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.variadic, [
|
|
793
|
+
"param0",
|
|
794
|
+
"",
|
|
795
|
+
"P\"2!\"/\""
|
|
796
|
+
])).map(__assignType(([name, option]) => {
|
|
607
797
|
if (option.kind === require_types_command.CommandParameterKinds.string) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env}` : ""}${option.variadic ? option.default !== void 0 ? `${option.env ? " ?? " : ""}${JSON.stringify(option.default)}` : option.env ? " ?? []" : "[]" : option.default !== void 0 ? `${option.env ? " ?? " : ""}"${option.default}"` : ""}, `;
|
|
608
798
|
else if (option.kind === require_types_command.CommandParameterKinds.number) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env}` : ""}${option.variadic ? option.default && Array.isArray(option.default) ? `${option.env ? " ?? " : ""}${JSON.stringify(option.default)}` : option.env ? " ?? []" : "[]" : option.default !== void 0 ? `${option.env ? " ?? " : ""}${option.default}` : ""}, `;
|
|
609
799
|
else if (option.kind === require_types_command.CommandParameterKinds.boolean) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env} ?? ` : ""}${option.default ? "true" : "false"},`;
|
|
610
800
|
return "";
|
|
611
|
-
}
|
|
801
|
+
}, [
|
|
802
|
+
"param0",
|
|
803
|
+
"",
|
|
804
|
+
"P\"2!\"/\""
|
|
805
|
+
])).join("")}
|
|
612
806
|
} as unknown as ${segments.length > 0 ? (0, _stryke_string_format_pascal_case.pascalCase)(_name) : "Global"}Options;`;
|
|
613
807
|
}
|
|
614
808
|
}),
|
|
615
809
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
616
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`for (let i = 0; i < args.slice(${segments.filter((segment) => require_context_helpers.isDynamicPathSegment(segment)
|
|
810
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`for (let i = 0; i < args.slice(${segments.filter(__assignType((segment) => require_context_helpers.isDynamicPathSegment(segment), [
|
|
811
|
+
"segment",
|
|
812
|
+
"",
|
|
813
|
+
"P\"2!\"/\""
|
|
814
|
+
])).length}).length; i++) { `),
|
|
617
815
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
618
816
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
619
817
|
"const": true,
|
|
@@ -631,55 +829,81 @@ function OptionsParserLogic(props) {
|
|
|
631
829
|
return Object.entries(options.value);
|
|
632
830
|
},
|
|
633
831
|
hardline: true,
|
|
634
|
-
children
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
832
|
+
get children() {
|
|
833
|
+
return __assignType(([name, option], i) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
834
|
+
when: i === 0,
|
|
835
|
+
get fallback() {
|
|
836
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
837
|
+
get condition() {
|
|
838
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserCondition, {
|
|
839
|
+
name,
|
|
840
|
+
get alias() {
|
|
841
|
+
return option.alias;
|
|
842
|
+
},
|
|
843
|
+
isCaseSensitive
|
|
844
|
+
})];
|
|
845
|
+
},
|
|
846
|
+
get children() {
|
|
847
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserLogic, {
|
|
848
|
+
name,
|
|
849
|
+
option,
|
|
850
|
+
isCaseSensitive
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
},
|
|
855
|
+
get children() {
|
|
856
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
857
|
+
get condition() {
|
|
858
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserCondition, {
|
|
859
|
+
name,
|
|
860
|
+
get alias() {
|
|
861
|
+
return option.alias;
|
|
862
|
+
},
|
|
863
|
+
isCaseSensitive
|
|
864
|
+
});
|
|
865
|
+
},
|
|
866
|
+
get children() {
|
|
867
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserLogic, {
|
|
868
|
+
name,
|
|
869
|
+
option,
|
|
870
|
+
isCaseSensitive
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
}), [
|
|
876
|
+
"param0",
|
|
877
|
+
"i",
|
|
878
|
+
"",
|
|
879
|
+
"P\"2!\"2\"\"/#"
|
|
880
|
+
]);
|
|
881
|
+
}
|
|
677
882
|
}),
|
|
678
883
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
679
884
|
_alloy_js_core.code` } `,
|
|
680
885
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
681
886
|
];
|
|
682
887
|
}
|
|
888
|
+
OptionsParserLogic.__type = [
|
|
889
|
+
() => __ΩOptionsParserLogicProps,
|
|
890
|
+
"props",
|
|
891
|
+
"OptionsParserLogic",
|
|
892
|
+
"The command options parser logic.",
|
|
893
|
+
"Pn!2\"\"/#?$"
|
|
894
|
+
];
|
|
895
|
+
const __ΩCommandParserLogicProps = [
|
|
896
|
+
"CommandTree",
|
|
897
|
+
"command",
|
|
898
|
+
"The command to generate the parser logic for.",
|
|
899
|
+
"appSpecificEnvPrefix",
|
|
900
|
+
"The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).",
|
|
901
|
+
"isCaseSensitive",
|
|
902
|
+
true,
|
|
903
|
+
"Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.",
|
|
904
|
+
"CommandParserLogicProps",
|
|
905
|
+
"P\"w!4\"?#&4$?%)4&8>'?(Mw)y"
|
|
906
|
+
];
|
|
683
907
|
/**
|
|
684
908
|
* The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.
|
|
685
909
|
*/
|
|
@@ -713,6 +937,13 @@ function CommandParserLogic(props) {
|
|
|
713
937
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
714
938
|
];
|
|
715
939
|
}
|
|
940
|
+
CommandParserLogic.__type = [
|
|
941
|
+
() => __ΩCommandParserLogicProps,
|
|
942
|
+
"props",
|
|
943
|
+
"CommandParserLogic",
|
|
944
|
+
"The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.",
|
|
945
|
+
"Pn!2\"\"/#?$"
|
|
946
|
+
];
|
|
716
947
|
|
|
717
948
|
//#endregion
|
|
718
949
|
exports.ArgumentsParserLogic = ArgumentsParserLogic;
|
|
@@ -722,4 +953,10 @@ exports.OptionsInterfaceDeclaration = OptionsInterfaceDeclaration;
|
|
|
722
953
|
exports.OptionsMember = OptionsMember;
|
|
723
954
|
exports.OptionsMemberParserCondition = OptionsMemberParserCondition;
|
|
724
955
|
exports.OptionsMemberParserLogic = OptionsMemberParserLogic;
|
|
725
|
-
exports.OptionsParserLogic = OptionsParserLogic;
|
|
956
|
+
exports.OptionsParserLogic = OptionsParserLogic;
|
|
957
|
+
exports.__ΩArgumentsParserLogicProps = __ΩArgumentsParserLogicProps;
|
|
958
|
+
exports.__ΩCommandParserLogicProps = __ΩCommandParserLogicProps;
|
|
959
|
+
exports.__ΩDynamicSegmentsParserLogicProps = __ΩDynamicSegmentsParserLogicProps;
|
|
960
|
+
exports.__ΩOptionsMemberParserConditionProps = __ΩOptionsMemberParserConditionProps;
|
|
961
|
+
exports.__ΩOptionsMemberParserLogicProps = __ΩOptionsMemberParserLogicProps;
|
|
962
|
+
exports.__ΩOptionsParserLogicProps = __ΩOptionsParserLogicProps;
|