@gearbox-protocol/cli-utils 5.39.0 → 5.39.2
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/Zommand.js +9 -11
- package/package.json +2 -2
package/dist/Zommand.js
CHANGED
|
@@ -16,12 +16,10 @@ export class Zommand extends Command {
|
|
|
16
16
|
this.#addOptionsFromObject(def);
|
|
17
17
|
}
|
|
18
18
|
else if (def.type === "union") {
|
|
19
|
-
// https://github.com/colinhacks/zod/issues/4873
|
|
20
|
-
const discriminator = def.discriminator;
|
|
21
19
|
for (const o of def.options) {
|
|
22
20
|
const opt = o;
|
|
23
21
|
if (opt._zod.def.type === "object") {
|
|
24
|
-
this.#addOptionsFromObject(opt._zod.def
|
|
22
|
+
this.#addOptionsFromObject(opt._zod.def);
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
25
|
}
|
|
@@ -36,20 +34,20 @@ export class Zommand extends Command {
|
|
|
36
34
|
this.addOption(opt);
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
|
-
#addOptionsFromObject(def
|
|
37
|
+
#addOptionsFromObject(def) {
|
|
40
38
|
const shape = def.shape;
|
|
41
39
|
for (const [key, optionSchema] of Object.entries(shape)) {
|
|
42
40
|
const meta = zommandRegistry.get(optionSchema);
|
|
43
41
|
if (!meta) {
|
|
44
42
|
continue;
|
|
45
43
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
// this avoids duplicate options in case of discriminated unions
|
|
45
|
+
const existing = this.options.find(o => o.flags === meta.flags);
|
|
46
|
+
if (!existing) {
|
|
47
|
+
this.addOption(new Option(meta.flags, meta.description));
|
|
48
|
+
if (meta.env) {
|
|
49
|
+
this.#envToObjectKeys[meta.env] = key;
|
|
50
|
+
}
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/cli-utils",
|
|
3
3
|
"description": "Utils for creating cli apps",
|
|
4
|
-
"version": "5.39.
|
|
4
|
+
"version": "5.39.2",
|
|
5
5
|
"homepage": "https://gearbox.fi",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"gearbox"
|
|
@@ -40,6 +40,6 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@commander-js/extra-typings": "^14.0.0",
|
|
42
42
|
"@types/lodash-es": "^4.17.12",
|
|
43
|
-
"@types/node": "^24.0
|
|
43
|
+
"@types/node": "^24.1.0"
|
|
44
44
|
}
|
|
45
45
|
}
|