@shell-shock/core 0.12.2 → 0.13.1
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/api.cjs +3 -2
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +0 -1
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts +0 -1
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +1 -1
- package/dist/api.mjs.map +1 -1
- package/dist/components/command-validation-logic.cjs +54 -53
- package/dist/components/command-validation-logic.cjs.map +1 -1
- package/dist/components/command-validation-logic.d.cts +2 -3
- package/dist/components/command-validation-logic.d.cts.map +1 -1
- package/dist/components/command-validation-logic.d.mts +2 -3
- package/dist/components/command-validation-logic.d.mts.map +1 -1
- package/dist/components/command-validation-logic.mjs +1 -1
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +45 -44
- package/dist/components/docs.cjs.map +1 -1
- package/dist/components/docs.d.cts +5 -5
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +5 -5
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/helpers.cjs +16 -15
- package/dist/components/helpers.cjs.map +1 -1
- package/dist/components/helpers.d.cts +7 -8
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +7 -8
- package/dist/components/helpers.d.mts.map +1 -1
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/index.cjs +1 -0
- package/dist/components/options-parser-logic.cjs +187 -186
- package/dist/components/options-parser-logic.cjs.map +1 -1
- package/dist/components/options-parser-logic.d.cts +9 -9
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +9 -9
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/usage.cjs +21 -20
- package/dist/components/usage.cjs.map +1 -1
- package/dist/components/usage.d.cts +2 -2
- package/dist/components/usage.d.cts.map +1 -1
- package/dist/components/usage.d.mts.map +1 -1
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +128 -127
- package/dist/components/utils-builtin.cjs.map +1 -1
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +4 -4
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/config.cjs +1 -0
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +0 -1
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +0 -1
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs.map +1 -1
- package/dist/contexts/command.cjs +5 -4
- package/dist/contexts/command.cjs.map +1 -1
- package/dist/contexts/command.d.cts +0 -1
- package/dist/contexts/command.d.cts.map +1 -1
- package/dist/contexts/command.d.mts +0 -1
- package/dist/contexts/command.d.mts.map +1 -1
- package/dist/contexts/index.cjs +1 -0
- package/dist/contexts/options.cjs +12 -11
- package/dist/contexts/options.cjs.map +1 -1
- package/dist/contexts/options.d.cts +0 -1
- package/dist/contexts/options.d.cts.map +1 -1
- package/dist/contexts/options.d.mts +0 -1
- package/dist/contexts/options.d.mts.map +1 -1
- package/dist/contexts/options.mjs +3 -3
- package/dist/contexts/options.mjs.map +1 -1
- package/dist/helpers/automd.cjs +16 -16
- package/dist/helpers/automd.cjs.map +1 -1
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/helpers/docs-helpers.cjs +3 -3
- package/dist/helpers/docs-helpers.cjs.map +1 -1
- package/dist/helpers/docs-helpers.mjs.map +1 -1
- package/dist/helpers/paths.cjs +26 -26
- package/dist/helpers/paths.cjs.map +1 -1
- package/dist/helpers/paths.mjs +1 -1
- package/dist/helpers/paths.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +3 -3
- package/dist/helpers/persistence.cjs.map +1 -1
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/update-package-json.cjs +16 -16
- package/dist/helpers/update-package-json.cjs.map +1 -1
- package/dist/helpers/update-package-json.mjs.map +1 -1
- package/dist/helpers/utilities.cjs +9 -9
- package/dist/helpers/utilities.cjs.map +1 -1
- package/dist/helpers/utilities.mjs.map +1 -1
- package/dist/helpers/validations.cjs.map +1 -1
- package/dist/helpers/validations.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.mts +0 -1
- package/dist/plugin-utils/context-helpers.cjs +10 -10
- package/dist/plugin-utils/context-helpers.cjs.map +1 -1
- package/dist/plugin-utils/context-helpers.d.cts +0 -3
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/context-helpers.d.mts +0 -3
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.mjs +1 -1
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/deepkit.cjs +18 -18
- package/dist/plugin-utils/deepkit.cjs.map +1 -1
- package/dist/plugin-utils/deepkit.d.cts +0 -1
- package/dist/plugin-utils/deepkit.d.cts.map +1 -1
- package/dist/plugin-utils/deepkit.d.mts +0 -1
- package/dist/plugin-utils/deepkit.d.mts.map +1 -1
- package/dist/plugin-utils/deepkit.mjs.map +1 -1
- package/dist/plugin-utils/description-helpers.cjs.map +1 -1
- package/dist/plugin-utils/description-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/description-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/description-helpers.mjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.cjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.cts +0 -1
- package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.mts +0 -1
- package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +1 -0
- package/dist/plugin-utils/reflect.cjs.map +1 -1
- package/dist/plugin-utils/reflect.d.cts +0 -1
- package/dist/plugin-utils/reflect.d.cts.map +1 -1
- package/dist/plugin-utils/reflect.d.mts +0 -1
- package/dist/plugin-utils/reflect.d.mts.map +1 -1
- package/dist/plugin-utils/reflect.mjs.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.cjs.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.d.cts +0 -1
- package/dist/plugin-utils/traverse-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.d.mts +0 -1
- package/dist/plugin-utils/traverse-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/type-checks.cjs +7 -7
- package/dist/plugin-utils/type-checks.cjs.map +1 -1
- package/dist/plugin-utils/type-checks.d.cts +0 -1
- package/dist/plugin-utils/type-checks.d.cts.map +1 -1
- package/dist/plugin-utils/type-checks.d.mts +0 -1
- package/dist/plugin-utils/type-checks.d.mts.map +1 -1
- package/dist/plugin-utils/type-checks.mjs +1 -1
- package/dist/plugin-utils/type-checks.mjs.map +1 -1
- package/dist/plugin.cjs +68 -75
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +0 -1
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +0 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +23 -30
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +29 -29
- package/dist/resolver/deepkit.cjs.map +1 -1
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/dist/resolver/helpers.cjs +17 -17
- package/dist/resolver/helpers.cjs.map +1 -1
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/module.cjs +29 -29
- package/dist/resolver/module.cjs.map +1 -1
- package/dist/resolver/module.mjs +1 -1
- package/dist/resolver/module.mjs.map +1 -1
- package/dist/resolver/resolve.cjs +17 -17
- package/dist/resolver/resolve.cjs.map +1 -1
- package/dist/resolver/resolve.mjs +3 -3
- package/dist/resolver/resolve.mjs.map +1 -1
- package/dist/types/command.cjs +1 -0
- package/dist/types/command.cjs.map +1 -1
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/config.cjs +1 -0
- package/dist/types/config.cjs.map +1 -1
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs.map +1 -1
- package/dist/types/context.cjs +1 -0
- package/dist/types/context.cjs.map +1 -1
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/env.cjs +1 -0
- package/dist/types/env.d.cts.map +1 -1
- package/dist/types/env.d.mts.map +1 -1
- package/dist/types/index.cjs +1 -0
- package/dist/types/options.cjs +1 -0
- package/dist/types/options.d.cts.map +1 -1
- package/dist/types/options.d.mts.map +1 -1
- package/dist/types/runtime.cjs +1 -0
- package/dist/types/runtime.d.cts.map +1 -1
- package/dist/types/runtime.d.mts.map +1 -1
- package/package.json +23 -23
|
@@ -1,46 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
|
|
3
4
|
const require_types_command = require('../types/command.cjs');
|
|
4
5
|
const require_contexts_options = require('../contexts/options.cjs');
|
|
5
6
|
const require_components_helpers = require('./helpers.cjs');
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
let
|
|
11
|
-
let
|
|
12
|
-
let
|
|
13
|
-
let
|
|
7
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
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 _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
11
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
12
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
13
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
14
|
+
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
14
15
|
|
|
15
16
|
//#region src/components/options-parser-logic.tsx
|
|
16
17
|
function DynamicSegmentsParserLogic(props) {
|
|
17
18
|
const { command } = props;
|
|
18
|
-
return (0,
|
|
19
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
19
20
|
get each() {
|
|
20
21
|
return command.segments ?? [];
|
|
21
22
|
},
|
|
22
|
-
children: (segment, index) => (0,
|
|
23
|
+
children: (segment, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
23
24
|
get when() {
|
|
24
25
|
return require_context_helpers.isDynamicPathSegment(segment);
|
|
25
26
|
},
|
|
26
27
|
get children() {
|
|
27
28
|
return [
|
|
28
|
-
(0,
|
|
29
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
29
30
|
"let": true,
|
|
30
31
|
get name() {
|
|
31
|
-
return (0,
|
|
32
|
+
return (0, _stryke_string_format_camel_case.camelCase)(require_context_helpers.getDynamicPathSegmentName(segment));
|
|
32
33
|
},
|
|
33
34
|
type: "string | undefined"
|
|
34
35
|
}),
|
|
35
|
-
(0,
|
|
36
|
-
(0,
|
|
37
|
-
condition:
|
|
36
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
37
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
38
|
+
condition: _alloy_js_core.code`args.length > ${2 + index} && args[${2 + index}]`,
|
|
38
39
|
get children() {
|
|
39
|
-
return
|
|
40
|
+
return _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(require_context_helpers.getDynamicPathSegmentName(segment))} = args[${2 + index}];`;
|
|
40
41
|
}
|
|
41
42
|
}),
|
|
42
|
-
(0,
|
|
43
|
-
(0,
|
|
43
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
44
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
44
45
|
];
|
|
45
46
|
}
|
|
46
47
|
})
|
|
@@ -48,113 +49,113 @@ function DynamicSegmentsParserLogic(props) {
|
|
|
48
49
|
}
|
|
49
50
|
function ArgumentsParserLogic(props) {
|
|
50
51
|
const { command, appSpecificEnvPrefix, isCaseSensitive } = props;
|
|
51
|
-
return (0,
|
|
52
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
52
53
|
get when() {
|
|
53
54
|
return command.args && command.args.length > 0;
|
|
54
55
|
},
|
|
55
56
|
get children() {
|
|
56
57
|
return [
|
|
57
|
-
(0,
|
|
58
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
58
59
|
"let": true,
|
|
59
60
|
name: "optionsIndex",
|
|
60
61
|
type: "number",
|
|
61
62
|
get initializer() {
|
|
62
|
-
return
|
|
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("_", "")).join("|")}`).join("|")})=?.*$/.test(arg${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"}))) + ${command.segments.length + 1};`;
|
|
63
64
|
}
|
|
64
65
|
}),
|
|
65
|
-
(0,
|
|
66
|
-
(0,
|
|
66
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
67
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
67
68
|
"let": true,
|
|
68
69
|
name: "argsIndex",
|
|
69
70
|
type: "number",
|
|
70
71
|
get initializer() {
|
|
71
|
-
return
|
|
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("_", "")).join("|")}`).join("|")})=?.*$/.test(arg${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"}))) + ${command.segments.length + 1});`;
|
|
72
73
|
}
|
|
73
74
|
}),
|
|
74
|
-
(0,
|
|
75
|
-
(0,
|
|
75
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
76
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
76
77
|
get each() {
|
|
77
78
|
return command.args ?? [];
|
|
78
79
|
},
|
|
79
80
|
hardline: true,
|
|
80
81
|
children: (arg, index) => [
|
|
81
|
-
(0,
|
|
82
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
82
83
|
get when() {
|
|
83
|
-
return (0,
|
|
84
|
+
return (0, _stryke_type_checks_is_set_string.isSetString)(arg.env) || arg.default !== void 0 || (arg.kind === require_types_command.CommandParameterKinds.string || arg.kind === require_types_command.CommandParameterKinds.number) && arg.variadic;
|
|
84
85
|
},
|
|
85
86
|
get fallback() {
|
|
86
87
|
return [
|
|
87
|
-
(0,
|
|
88
|
-
(0,
|
|
89
|
-
|
|
88
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`let ${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}!: `),
|
|
89
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg }),
|
|
90
|
+
_alloy_js_core.code`; `
|
|
90
91
|
];
|
|
91
92
|
},
|
|
92
93
|
get children() {
|
|
93
|
-
return (0,
|
|
94
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
94
95
|
"let": true,
|
|
95
96
|
get name() {
|
|
96
|
-
return (0,
|
|
97
|
+
return (0, _stryke_string_format_camel_case.camelCase)(arg.name);
|
|
97
98
|
},
|
|
98
99
|
get type() {
|
|
99
|
-
return (0,
|
|
100
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg });
|
|
100
101
|
},
|
|
101
102
|
get initializer() {
|
|
102
|
-
return [(0,
|
|
103
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
103
104
|
get when() {
|
|
104
|
-
return (0,
|
|
105
|
+
return (0, _stryke_type_checks_is_set_string.isSetString)(arg.env);
|
|
105
106
|
},
|
|
106
107
|
get children() {
|
|
107
|
-
return
|
|
108
|
+
return _alloy_js_core.code`env.${appSpecificEnvPrefix}_${(0, _stryke_string_format_constant_case.constantCase)(String(arg.env))} ?? `;
|
|
108
109
|
}
|
|
109
|
-
}), (0,
|
|
110
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
110
111
|
get when() {
|
|
111
112
|
return arg.default !== void 0;
|
|
112
113
|
},
|
|
113
114
|
get fallback() {
|
|
114
|
-
return (arg.kind === require_types_command.CommandParameterKinds.string || arg.kind === require_types_command.CommandParameterKinds.number) && arg.variadic ?
|
|
115
|
+
return (arg.kind === require_types_command.CommandParameterKinds.string || arg.kind === require_types_command.CommandParameterKinds.number) && arg.variadic ? _alloy_js_core.code`[]` : _alloy_js_core.code`undefined;`;
|
|
115
116
|
},
|
|
116
117
|
get children() {
|
|
117
|
-
return arg.kind === require_types_command.CommandParameterKinds.string ?
|
|
118
|
+
return arg.kind === require_types_command.CommandParameterKinds.string ? _alloy_js_core.code`"${arg.default}"` : _alloy_js_core.code`${arg.default}`;
|
|
118
119
|
}
|
|
119
120
|
})];
|
|
120
121
|
}
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
124
|
}),
|
|
124
|
-
(0,
|
|
125
|
-
(0,
|
|
126
|
-
condition:
|
|
125
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
126
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
127
|
+
condition: _alloy_js_core.code`argsIndex + ${index} < args.length && argsIndex + ${index} !== optionsIndex`,
|
|
127
128
|
get children() {
|
|
128
|
-
return [(0,
|
|
129
|
+
return [(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = `), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
129
130
|
get when() {
|
|
130
131
|
return arg.kind === require_types_command.CommandParameterKinds.string || arg.kind === require_types_command.CommandParameterKinds.number;
|
|
131
132
|
},
|
|
132
133
|
get fallback() {
|
|
133
|
-
return (0,
|
|
134
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.BooleanInputParserLogic, { name: `args[argsIndex + ${index}] ` });
|
|
134
135
|
},
|
|
135
136
|
get children() {
|
|
136
|
-
return (0,
|
|
137
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
137
138
|
get when() {
|
|
138
139
|
return (arg.kind === require_types_command.CommandParameterKinds.string || arg.kind === require_types_command.CommandParameterKinds.number) && arg.variadic;
|
|
139
140
|
},
|
|
140
141
|
get fallback() {
|
|
141
|
-
return (0,
|
|
142
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
142
143
|
get when() {
|
|
143
144
|
return arg.kind === require_types_command.CommandParameterKinds.number;
|
|
144
145
|
},
|
|
145
|
-
fallback:
|
|
146
|
-
children:
|
|
146
|
+
fallback: _alloy_js_core.code`args[argsIndex + ${index}]; `,
|
|
147
|
+
children: _alloy_js_core.code`Number(args[argsIndex + ${index}]); `
|
|
147
148
|
});
|
|
148
149
|
},
|
|
149
150
|
get children() {
|
|
150
|
-
return
|
|
151
|
+
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)`;
|
|
151
152
|
}
|
|
152
153
|
});
|
|
153
154
|
}
|
|
154
155
|
})];
|
|
155
156
|
}
|
|
156
157
|
}),
|
|
157
|
-
(0,
|
|
158
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
158
159
|
]
|
|
159
160
|
})
|
|
160
161
|
];
|
|
@@ -166,24 +167,24 @@ function ArgumentsParserLogic(props) {
|
|
|
166
167
|
*/
|
|
167
168
|
function OptionsMember({ option }) {
|
|
168
169
|
const doc = option.description || `The ${option.title} command option.`;
|
|
169
|
-
return [(0,
|
|
170
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
170
171
|
get when() {
|
|
171
172
|
return Boolean(option.name);
|
|
172
173
|
},
|
|
173
174
|
get children() {
|
|
174
175
|
return [
|
|
175
|
-
(0,
|
|
176
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
176
177
|
get when() {
|
|
177
178
|
return option.kind === require_types_command.CommandParameterKinds.string;
|
|
178
179
|
},
|
|
179
180
|
get children() {
|
|
180
|
-
return (0,
|
|
181
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
181
182
|
get name() {
|
|
182
183
|
return option.name;
|
|
183
184
|
},
|
|
184
185
|
doc,
|
|
185
186
|
get type() {
|
|
186
|
-
return (0,
|
|
187
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: option });
|
|
187
188
|
},
|
|
188
189
|
get optional() {
|
|
189
190
|
return option.optional;
|
|
@@ -191,18 +192,18 @@ function OptionsMember({ option }) {
|
|
|
191
192
|
});
|
|
192
193
|
}
|
|
193
194
|
}),
|
|
194
|
-
(0,
|
|
195
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
195
196
|
get when() {
|
|
196
197
|
return option.kind === require_types_command.CommandParameterKinds.number;
|
|
197
198
|
},
|
|
198
199
|
get children() {
|
|
199
|
-
return (0,
|
|
200
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
200
201
|
get name() {
|
|
201
202
|
return option.name;
|
|
202
203
|
},
|
|
203
204
|
doc,
|
|
204
205
|
get type() {
|
|
205
|
-
return (0,
|
|
206
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: option });
|
|
206
207
|
},
|
|
207
208
|
get optional() {
|
|
208
209
|
return option.optional;
|
|
@@ -210,18 +211,18 @@ function OptionsMember({ option }) {
|
|
|
210
211
|
});
|
|
211
212
|
}
|
|
212
213
|
}),
|
|
213
|
-
(0,
|
|
214
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
214
215
|
get when() {
|
|
215
216
|
return option.kind === require_types_command.CommandParameterKinds.boolean;
|
|
216
217
|
},
|
|
217
218
|
get children() {
|
|
218
|
-
return (0,
|
|
219
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
219
220
|
get name() {
|
|
220
221
|
return option.name;
|
|
221
222
|
},
|
|
222
223
|
doc,
|
|
223
224
|
get type() {
|
|
224
|
-
return (0,
|
|
225
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: option });
|
|
225
226
|
},
|
|
226
227
|
get optional() {
|
|
227
228
|
return option.optional;
|
|
@@ -239,164 +240,164 @@ function OptionsMember({ option }) {
|
|
|
239
240
|
function OptionsMemberParserLogic(props) {
|
|
240
241
|
const { name, option, isCaseSensitive } = props;
|
|
241
242
|
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("_", "")).join("|")})=/`;
|
|
242
|
-
return [(0,
|
|
243
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
243
244
|
get when() {
|
|
244
245
|
return option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number;
|
|
245
246
|
},
|
|
246
247
|
get children() {
|
|
247
|
-
return [(0,
|
|
248
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
248
249
|
get when() {
|
|
249
250
|
return option.variadic;
|
|
250
251
|
},
|
|
251
252
|
get children() {
|
|
252
253
|
return [
|
|
253
|
-
(0,
|
|
254
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
254
255
|
get when() {
|
|
255
256
|
return name.includes("?") || name.includes("-");
|
|
256
257
|
},
|
|
257
|
-
fallback:
|
|
258
|
-
children:
|
|
258
|
+
fallback: _alloy_js_core.code`options.${name} ??= []; `,
|
|
259
|
+
children: _alloy_js_core.code`options["${name}"] ??= []; `
|
|
259
260
|
}),
|
|
260
|
-
(0,
|
|
261
|
-
(0,
|
|
261
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
262
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
262
263
|
condition: `${equalsRegex}.test(${isCaseSensitive ? "arg" : "\"-\" + arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"})`,
|
|
263
264
|
get children() {
|
|
264
265
|
return [
|
|
265
|
-
(0,
|
|
266
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
266
267
|
get when() {
|
|
267
268
|
return name.includes("?") || name.includes("-");
|
|
268
269
|
},
|
|
269
|
-
fallback:
|
|
270
|
-
children:
|
|
270
|
+
fallback: _alloy_js_core.code`options.${name}.push(`,
|
|
271
|
+
children: _alloy_js_core.code`options["${name}"].push(`
|
|
271
272
|
}),
|
|
272
|
-
(0,
|
|
273
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
273
274
|
get when() {
|
|
274
275
|
return option.kind === require_types_command.CommandParameterKinds.string;
|
|
275
276
|
},
|
|
276
|
-
children:
|
|
277
|
+
children: _alloy_js_core.code`...arg.replace(${equalsRegex}, "").split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean) `
|
|
277
278
|
}),
|
|
278
|
-
(0,
|
|
279
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
279
280
|
get when() {
|
|
280
281
|
return option.kind === require_types_command.CommandParameterKinds.number;
|
|
281
282
|
},
|
|
282
|
-
children:
|
|
283
|
+
children: _alloy_js_core.code`...arg.replace(${equalsRegex}, "").split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `
|
|
283
284
|
}),
|
|
284
|
-
(0,
|
|
285
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
285
286
|
get when() {
|
|
286
287
|
return (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.choices && option.choices.length > 0;
|
|
287
288
|
},
|
|
288
289
|
get children() {
|
|
289
|
-
return
|
|
290
|
+
return _alloy_js_core.code` as ${option.choices?.map((choice) => (0, _stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice).join(" | ")} `;
|
|
290
291
|
}
|
|
291
292
|
}),
|
|
292
|
-
|
|
293
|
+
_alloy_js_core.code`); `
|
|
293
294
|
];
|
|
294
295
|
}
|
|
295
296
|
}),
|
|
296
|
-
(0,
|
|
297
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
297
298
|
condition: `args.length > i + 1`,
|
|
298
299
|
get children() {
|
|
299
300
|
return [
|
|
300
|
-
(0,
|
|
301
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
301
302
|
get when() {
|
|
302
303
|
return name.includes("?") || name.includes("-");
|
|
303
304
|
},
|
|
304
|
-
fallback:
|
|
305
|
-
children:
|
|
305
|
+
fallback: _alloy_js_core.code`options.${name}.push(`,
|
|
306
|
+
children: _alloy_js_core.code`options["${name}"].push(`
|
|
306
307
|
}),
|
|
307
|
-
(0,
|
|
308
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
308
309
|
get when() {
|
|
309
310
|
return option.kind === require_types_command.CommandParameterKinds.string;
|
|
310
311
|
},
|
|
311
|
-
children:
|
|
312
|
+
children: _alloy_js_core.code`...args[++i].split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean) `
|
|
312
313
|
}),
|
|
313
|
-
(0,
|
|
314
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
314
315
|
get when() {
|
|
315
316
|
return option.kind === require_types_command.CommandParameterKinds.number;
|
|
316
317
|
},
|
|
317
|
-
children:
|
|
318
|
+
children: _alloy_js_core.code`...args[++i].split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `
|
|
318
319
|
}),
|
|
319
|
-
(0,
|
|
320
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
320
321
|
get when() {
|
|
321
322
|
return (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.choices && option.choices.length > 0;
|
|
322
323
|
},
|
|
323
324
|
get children() {
|
|
324
|
-
return
|
|
325
|
+
return _alloy_js_core.code` as ${option.choices?.map((choice) => (0, _stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice).join(" | ")} `;
|
|
325
326
|
}
|
|
326
327
|
}),
|
|
327
|
-
|
|
328
|
+
_alloy_js_core.code`); `
|
|
328
329
|
];
|
|
329
330
|
}
|
|
330
331
|
})
|
|
331
332
|
];
|
|
332
333
|
}
|
|
333
|
-
}), (0,
|
|
334
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
334
335
|
get when() {
|
|
335
336
|
return !option.variadic;
|
|
336
337
|
},
|
|
337
338
|
get children() {
|
|
338
339
|
return [
|
|
339
|
-
(0,
|
|
340
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
340
341
|
condition: `${equalsRegex}.test(${isCaseSensitive ? "arg" : "\"-\" + arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"})`,
|
|
341
342
|
get children() {
|
|
342
|
-
return [(0,
|
|
343
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
343
344
|
get when() {
|
|
344
345
|
return option.kind === require_types_command.CommandParameterKinds.string;
|
|
345
346
|
},
|
|
346
347
|
get children() {
|
|
347
348
|
return [
|
|
348
|
-
(0,
|
|
349
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
349
350
|
get when() {
|
|
350
351
|
return name.includes("?") || name.includes("-");
|
|
351
352
|
},
|
|
352
|
-
fallback:
|
|
353
|
-
children:
|
|
353
|
+
fallback: _alloy_js_core.code`options.${name}`,
|
|
354
|
+
children: _alloy_js_core.code`options["${name}"]`
|
|
354
355
|
}),
|
|
355
|
-
|
|
356
|
-
(0,
|
|
356
|
+
_alloy_js_core.code` = arg.replace(${equalsRegex}, "").trim().replace(/^("|')/, "").replace(/("|')$/, "")`,
|
|
357
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
357
358
|
get when() {
|
|
358
359
|
return option.choices && option.choices.length > 0;
|
|
359
360
|
},
|
|
360
361
|
get children() {
|
|
361
|
-
return
|
|
362
|
+
return _alloy_js_core.code` as ${option.choices?.map((choice) => `"${choice}"`).join(" | ")}`;
|
|
362
363
|
}
|
|
363
364
|
}),
|
|
364
|
-
|
|
365
|
+
_alloy_js_core.code`; `
|
|
365
366
|
];
|
|
366
367
|
}
|
|
367
|
-
}), (0,
|
|
368
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
368
369
|
get when() {
|
|
369
370
|
return option.kind === require_types_command.CommandParameterKinds.number;
|
|
370
371
|
},
|
|
371
372
|
get children() {
|
|
372
373
|
return [
|
|
373
|
-
(0,
|
|
374
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
374
375
|
"const": true,
|
|
375
376
|
name: "value",
|
|
376
|
-
initializer:
|
|
377
|
+
initializer: _alloy_js_core.code` Number(arg.replace(${equalsRegex}, "").trim().replace(/^("|')/, "").replace(/("|')$/, "")); `
|
|
377
378
|
}),
|
|
378
|
-
(0,
|
|
379
|
-
(0,
|
|
379
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
380
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
380
381
|
condition: `!Number.isNaN(value)`,
|
|
381
382
|
get children() {
|
|
382
383
|
return [
|
|
383
|
-
(0,
|
|
384
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
384
385
|
get when() {
|
|
385
386
|
return name.includes("?") || name.includes("-");
|
|
386
387
|
},
|
|
387
|
-
fallback:
|
|
388
|
-
children:
|
|
388
|
+
fallback: _alloy_js_core.code`options.${name}`,
|
|
389
|
+
children: _alloy_js_core.code`options["${name}"]`
|
|
389
390
|
}),
|
|
390
|
-
|
|
391
|
-
(0,
|
|
391
|
+
_alloy_js_core.code` = value`,
|
|
392
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
392
393
|
get when() {
|
|
393
394
|
return option.choices && option.choices.length > 0;
|
|
394
395
|
},
|
|
395
396
|
get children() {
|
|
396
|
-
return
|
|
397
|
+
return _alloy_js_core.code` as ${option.choices?.join(" | ")}`;
|
|
397
398
|
}
|
|
398
399
|
}),
|
|
399
|
-
|
|
400
|
+
_alloy_js_core.code`; `
|
|
400
401
|
];
|
|
401
402
|
}
|
|
402
403
|
})
|
|
@@ -405,67 +406,67 @@ function OptionsMemberParserLogic(props) {
|
|
|
405
406
|
})];
|
|
406
407
|
}
|
|
407
408
|
}),
|
|
408
|
-
(0,
|
|
409
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
409
410
|
condition: `args.length > i + 1`,
|
|
410
411
|
get children() {
|
|
411
|
-
return [(0,
|
|
412
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
412
413
|
get when() {
|
|
413
414
|
return option.kind === require_types_command.CommandParameterKinds.string;
|
|
414
415
|
},
|
|
415
416
|
get children() {
|
|
416
417
|
return [
|
|
417
|
-
(0,
|
|
418
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
418
419
|
get when() {
|
|
419
420
|
return name.includes("?") || name.includes("-");
|
|
420
421
|
},
|
|
421
|
-
fallback:
|
|
422
|
-
children:
|
|
422
|
+
fallback: _alloy_js_core.code`options.${name}`,
|
|
423
|
+
children: _alloy_js_core.code`options["${name}"]`
|
|
423
424
|
}),
|
|
424
|
-
|
|
425
|
-
(0,
|
|
425
|
+
_alloy_js_core.code` = args[++i].trim().replace(/^("|')/, "").replace(/("|')$/, "")`,
|
|
426
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
426
427
|
get when() {
|
|
427
428
|
return option.choices && option.choices.length > 0;
|
|
428
429
|
},
|
|
429
430
|
get children() {
|
|
430
|
-
return
|
|
431
|
+
return _alloy_js_core.code` as ${option.choices?.map((choice) => `"${choice}"`).join(" | ")}`;
|
|
431
432
|
}
|
|
432
433
|
}),
|
|
433
|
-
|
|
434
|
+
_alloy_js_core.code`; `
|
|
434
435
|
];
|
|
435
436
|
}
|
|
436
|
-
}), (0,
|
|
437
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
437
438
|
get when() {
|
|
438
439
|
return option.kind === require_types_command.CommandParameterKinds.number;
|
|
439
440
|
},
|
|
440
441
|
get children() {
|
|
441
442
|
return [
|
|
442
|
-
(0,
|
|
443
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
443
444
|
"const": true,
|
|
444
445
|
name: "value",
|
|
445
|
-
initializer:
|
|
446
|
+
initializer: _alloy_js_core.code` Number(args[++i].trim().replace(/^("|')/, "").replace(/("|')$/, "")); `
|
|
446
447
|
}),
|
|
447
|
-
(0,
|
|
448
|
-
(0,
|
|
448
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
449
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
449
450
|
condition: `!Number.isNaN(value)`,
|
|
450
451
|
get children() {
|
|
451
452
|
return [
|
|
452
|
-
(0,
|
|
453
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
453
454
|
get when() {
|
|
454
455
|
return name.includes("?") || name.includes("-");
|
|
455
456
|
},
|
|
456
|
-
fallback:
|
|
457
|
-
children:
|
|
457
|
+
fallback: _alloy_js_core.code`options.${name}`,
|
|
458
|
+
children: _alloy_js_core.code`options["${name}"]`
|
|
458
459
|
}),
|
|
459
|
-
|
|
460
|
-
(0,
|
|
460
|
+
_alloy_js_core.code` = value`,
|
|
461
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
461
462
|
get when() {
|
|
462
463
|
return option.choices && option.choices.length > 0;
|
|
463
464
|
},
|
|
464
465
|
get children() {
|
|
465
|
-
return
|
|
466
|
+
return _alloy_js_core.code` as ${option.choices?.join(" | ")}`;
|
|
466
467
|
}
|
|
467
468
|
}),
|
|
468
|
-
|
|
469
|
+
_alloy_js_core.code`; `
|
|
469
470
|
];
|
|
470
471
|
}
|
|
471
472
|
})
|
|
@@ -474,61 +475,61 @@ function OptionsMemberParserLogic(props) {
|
|
|
474
475
|
})];
|
|
475
476
|
}
|
|
476
477
|
}),
|
|
477
|
-
(0,
|
|
478
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
478
479
|
];
|
|
479
480
|
}
|
|
480
481
|
})];
|
|
481
482
|
}
|
|
482
|
-
}), (0,
|
|
483
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
483
484
|
get when() {
|
|
484
485
|
return option.kind === require_types_command.CommandParameterKinds.boolean;
|
|
485
486
|
},
|
|
486
487
|
get children() {
|
|
487
488
|
return [
|
|
488
|
-
(0,
|
|
489
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
489
490
|
condition: `${equalsRegex}.test(${isCaseSensitive ? "arg" : "\"-\" + arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"})`,
|
|
490
491
|
get children() {
|
|
491
492
|
return [
|
|
492
|
-
(0,
|
|
493
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
493
494
|
"const": true,
|
|
494
495
|
name: "value",
|
|
495
|
-
initializer:
|
|
496
|
+
initializer: _alloy_js_core.code` arg.replace(${equalsRegex}, "").trim().replace(/^("|')/, "").replace(/("|')$/, "").toLowerCase(); `
|
|
496
497
|
}),
|
|
497
|
-
(0,
|
|
498
|
-
(0,
|
|
498
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
499
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
499
500
|
get when() {
|
|
500
501
|
return name.includes("?") || name.includes("-");
|
|
501
502
|
},
|
|
502
|
-
fallback:
|
|
503
|
-
children:
|
|
503
|
+
fallback: _alloy_js_core.code`options.${name} = `,
|
|
504
|
+
children: _alloy_js_core.code`options["${name}"] = `
|
|
504
505
|
}),
|
|
505
|
-
(0,
|
|
506
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.BooleanInputParserLogic, { name: "value" })
|
|
506
507
|
];
|
|
507
508
|
}
|
|
508
509
|
}),
|
|
509
|
-
(0,
|
|
510
|
-
return (0,
|
|
510
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
511
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
511
512
|
get when() {
|
|
512
513
|
return name.includes("?") || name.includes("-");
|
|
513
514
|
},
|
|
514
|
-
fallback:
|
|
515
|
-
children:
|
|
515
|
+
fallback: _alloy_js_core.code`options.${name} = true; `,
|
|
516
|
+
children: _alloy_js_core.code`options["${name}"] = true; `
|
|
516
517
|
});
|
|
517
518
|
} }),
|
|
518
|
-
(0,
|
|
519
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
519
520
|
get when() {
|
|
520
521
|
return Boolean(option.isNegativeOf);
|
|
521
522
|
},
|
|
522
523
|
get children() {
|
|
523
|
-
return [(0,
|
|
524
|
+
return [(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
524
525
|
get when() {
|
|
525
526
|
return option.isNegativeOf.includes("?") || option.isNegativeOf.includes("-");
|
|
526
527
|
},
|
|
527
528
|
get fallback() {
|
|
528
|
-
return
|
|
529
|
+
return _alloy_js_core.code`options.${option.isNegativeOf} = false; `;
|
|
529
530
|
},
|
|
530
531
|
get children() {
|
|
531
|
-
return
|
|
532
|
+
return _alloy_js_core.code`options["${option.isNegativeOf}"] = false; `;
|
|
532
533
|
}
|
|
533
534
|
})];
|
|
534
535
|
}
|
|
@@ -539,33 +540,33 @@ function OptionsMemberParserLogic(props) {
|
|
|
539
540
|
}
|
|
540
541
|
function OptionsMemberParserCondition(props) {
|
|
541
542
|
const { name, alias: aliasProp, isCaseSensitive } = props;
|
|
542
|
-
return [(0,
|
|
543
|
+
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, {
|
|
543
544
|
get when() {
|
|
544
545
|
return aliasProp && aliasProp.length > 0;
|
|
545
546
|
},
|
|
546
547
|
get children() {
|
|
547
|
-
return (0,
|
|
548
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
548
549
|
each: aliasProp ?? [],
|
|
549
|
-
children: (alias) =>
|
|
550
|
+
children: (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("_", "")}"`
|
|
550
551
|
});
|
|
551
552
|
}
|
|
552
553
|
})];
|
|
553
554
|
}
|
|
554
555
|
function OptionsInterfaceDeclaration(props) {
|
|
555
556
|
const { command } = props;
|
|
556
|
-
const options = (0,
|
|
557
|
-
return (0,
|
|
557
|
+
const options = (0, _alloy_js_core.computed)(() => require_contexts_options.computedOptions(command));
|
|
558
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
558
559
|
"export": true,
|
|
559
560
|
get name() {
|
|
560
|
-
return `${(0,
|
|
561
|
+
return `${(0, _stryke_string_format_pascal_case.pascalCase)(command.name)}Options`;
|
|
561
562
|
},
|
|
562
563
|
get children() {
|
|
563
|
-
return (0,
|
|
564
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
564
565
|
get each() {
|
|
565
566
|
return Object.values(options.value);
|
|
566
567
|
},
|
|
567
568
|
hardline: true,
|
|
568
|
-
children: (option) => (0,
|
|
569
|
+
children: (option) => (0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMember, { option })
|
|
569
570
|
});
|
|
570
571
|
}
|
|
571
572
|
});
|
|
@@ -575,47 +576,47 @@ function OptionsInterfaceDeclaration(props) {
|
|
|
575
576
|
*/
|
|
576
577
|
function OptionsParserLogic(props) {
|
|
577
578
|
const { command, appSpecificEnvPrefix, isCaseSensitive = false } = props;
|
|
578
|
-
const options = (0,
|
|
579
|
+
const options = (0, _alloy_js_core.computed)(() => require_contexts_options.computedOptions(command));
|
|
579
580
|
return [
|
|
580
|
-
(0,
|
|
581
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
581
582
|
"const": true,
|
|
582
583
|
name: "options",
|
|
583
584
|
get initializer() {
|
|
584
|
-
return
|
|
585
|
+
return _alloy_js_core.code` {
|
|
585
586
|
${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).map(([name, option]) => {
|
|
586
587
|
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}"` : ""}, `;
|
|
587
588
|
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}` : ""}, `;
|
|
588
589
|
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"},`;
|
|
589
590
|
return "";
|
|
590
591
|
}).join("")}
|
|
591
|
-
} as ${(0,
|
|
592
|
+
} as ${(0, _stryke_string_format_pascal_case.pascalCase)(command.name)}Options;`;
|
|
592
593
|
}
|
|
593
594
|
}),
|
|
594
|
-
(0,
|
|
595
|
-
(0,
|
|
596
|
-
(0,
|
|
597
|
-
(0,
|
|
595
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
596
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`for (let i = 0; i < args.slice(${command.segments.filter((segment) => require_context_helpers.isDynamicPathSegment(segment)).length}).length; i++) { `),
|
|
597
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
598
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
598
599
|
"const": true,
|
|
599
600
|
name: "arg",
|
|
600
601
|
type: "string",
|
|
601
|
-
initializer:
|
|
602
|
+
initializer: _alloy_js_core.code` args[i].length > 3 && args[i].startsWith("--")
|
|
602
603
|
? \`--\${args[i].slice(2).replaceAll("-", "")${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"}}\`
|
|
603
604
|
: args[i].length > 2 && args[i].startsWith("-")
|
|
604
605
|
? \`-\${args[i].slice(1).replaceAll("-", "")}\`
|
|
605
606
|
: args[i]; `
|
|
606
607
|
}),
|
|
607
|
-
(0,
|
|
608
|
-
(0,
|
|
608
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
609
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
609
610
|
get each() {
|
|
610
611
|
return Object.entries(options.value);
|
|
611
612
|
},
|
|
612
613
|
hardline: true,
|
|
613
|
-
children: ([name, option], i) => (0,
|
|
614
|
+
children: ([name, option], i) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
614
615
|
when: i === 0,
|
|
615
616
|
get fallback() {
|
|
616
|
-
return (0,
|
|
617
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
617
618
|
get condition() {
|
|
618
|
-
return [(0,
|
|
619
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserCondition, {
|
|
619
620
|
name,
|
|
620
621
|
get alias() {
|
|
621
622
|
return option.alias;
|
|
@@ -624,7 +625,7 @@ function OptionsParserLogic(props) {
|
|
|
624
625
|
})];
|
|
625
626
|
},
|
|
626
627
|
get children() {
|
|
627
|
-
return (0,
|
|
628
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserLogic, {
|
|
628
629
|
name,
|
|
629
630
|
option,
|
|
630
631
|
isCaseSensitive
|
|
@@ -633,9 +634,9 @@ function OptionsParserLogic(props) {
|
|
|
633
634
|
});
|
|
634
635
|
},
|
|
635
636
|
get children() {
|
|
636
|
-
return (0,
|
|
637
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
637
638
|
get condition() {
|
|
638
|
-
return (0,
|
|
639
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserCondition, {
|
|
639
640
|
name,
|
|
640
641
|
get alias() {
|
|
641
642
|
return option.alias;
|
|
@@ -644,7 +645,7 @@ function OptionsParserLogic(props) {
|
|
|
644
645
|
});
|
|
645
646
|
},
|
|
646
647
|
get children() {
|
|
647
|
-
return (0,
|
|
648
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserLogic, {
|
|
648
649
|
name,
|
|
649
650
|
option,
|
|
650
651
|
isCaseSensitive
|
|
@@ -654,9 +655,9 @@ function OptionsParserLogic(props) {
|
|
|
654
655
|
}
|
|
655
656
|
})
|
|
656
657
|
}),
|
|
657
|
-
(0,
|
|
658
|
-
|
|
659
|
-
(0,
|
|
658
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
659
|
+
_alloy_js_core.code` } `,
|
|
660
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
660
661
|
];
|
|
661
662
|
}
|
|
662
663
|
/**
|
|
@@ -665,23 +666,23 @@ function OptionsParserLogic(props) {
|
|
|
665
666
|
function CommandParserLogic(props) {
|
|
666
667
|
const { command, appSpecificEnvPrefix, isCaseSensitive = false } = props;
|
|
667
668
|
return [
|
|
668
|
-
(0,
|
|
669
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(DynamicSegmentsParserLogic, {
|
|
669
670
|
command,
|
|
670
671
|
isCaseSensitive
|
|
671
672
|
}),
|
|
672
|
-
(0,
|
|
673
|
-
(0,
|
|
673
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
674
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(OptionsParserLogic, {
|
|
674
675
|
command,
|
|
675
676
|
appSpecificEnvPrefix,
|
|
676
677
|
isCaseSensitive
|
|
677
678
|
}),
|
|
678
|
-
(0,
|
|
679
|
-
(0,
|
|
679
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
680
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(ArgumentsParserLogic, {
|
|
680
681
|
command,
|
|
681
682
|
appSpecificEnvPrefix,
|
|
682
683
|
isCaseSensitive
|
|
683
684
|
}),
|
|
684
|
-
(0,
|
|
685
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
685
686
|
];
|
|
686
687
|
}
|
|
687
688
|
|