viza 1.8.26 → 1.8.27
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/src/cli/program.js
CHANGED
|
@@ -61,17 +61,16 @@ export async function createProgram() {
|
|
|
61
61
|
sub = new Command(name);
|
|
62
62
|
sub.description(node.description || "");
|
|
63
63
|
parent.addCommand(sub);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
64
|
+
}
|
|
65
|
+
// Bind positional arguments from descriptor (must run even if sub already exists)
|
|
66
|
+
if (node.args?.length) {
|
|
67
|
+
for (const arg of node.args) {
|
|
68
|
+
const syntax = arg.required
|
|
69
|
+
? `<${arg.name}>`
|
|
70
|
+
: `[${arg.name}]`;
|
|
71
|
+
const exists = sub._args?.some((a) => a.name === arg.name);
|
|
72
|
+
if (!exists) {
|
|
73
|
+
sub.argument(syntax, arg.description);
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
76
|
}
|
|
@@ -53,10 +53,12 @@ export function buildCommandTree() {
|
|
|
53
53
|
parentNode.children.push(node);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
// leaf node → assign real handler
|
|
56
|
+
// leaf node → assign real handler + metadata
|
|
57
57
|
if (i === parts.length - 1) {
|
|
58
58
|
node.description = cmd.description;
|
|
59
59
|
node.run = cmd.run;
|
|
60
|
+
node.options = cmd.options;
|
|
61
|
+
node.args = cmd.args;
|
|
60
62
|
}
|
|
61
63
|
parentNode = node;
|
|
62
64
|
currentMap = node._childrenMap;
|