cloud-pc-templates 1.0.1 → 1.0.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/index.js +6 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -80,11 +80,12 @@ function showAvailableOptions(node, path) {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// Function to traverse command tree and execute or show options
|
|
83
|
-
function traverseCommandTree(args) {
|
|
84
|
-
let currentNode =
|
|
85
|
-
let path =
|
|
83
|
+
function traverseCommandTree(args, startNode, startPath = []) {
|
|
84
|
+
let currentNode = startNode;
|
|
85
|
+
let path = startPath;
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
// Start from the second argument (first is already matched in processArgs)
|
|
88
|
+
for (let i = 1; i < args.length; i++) {
|
|
88
89
|
let arg = args[i].replace(/^--/, ''); // Remove -- prefix
|
|
89
90
|
|
|
90
91
|
// Check if current node has subcommands
|
|
@@ -126,7 +127,7 @@ function processArgs() {
|
|
|
126
127
|
let command = args[0].replace(/^--/, '');
|
|
127
128
|
|
|
128
129
|
if (commandTree[command]) {
|
|
129
|
-
traverseCommandTree(args);
|
|
130
|
+
traverseCommandTree(args, commandTree[command], [command]);
|
|
130
131
|
} else {
|
|
131
132
|
console.log(`Unknown command: ${command}`);
|
|
132
133
|
help();
|