mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: support #677
This commit is contained in:
1 file changed
+11
@@ -73,6 +73,17 @@ async function cli() {
|
|||||||
args[i] = +args[i];
|
args[i] = +args[i];
|
||||||
} else if (args[i].startsWith('~')) {
|
} else if (args[i].startsWith('~')) {
|
||||||
args[i] = argv.options[args[i].substr(1)];
|
args[i] = argv.options[args[i].substr(1)];
|
||||||
|
} else if ((args[i].startsWith('[') && args[i].endsWith(']')) || (args[i].startsWith('{') && args[i].endsWith('}'))) {
|
||||||
|
try {
|
||||||
|
args[i] = JSON.parse(args[i]);
|
||||||
|
for (const key in args[i]) {
|
||||||
|
if (typeof args[i][key] === 'string' && ObjectId.isValid(args[i][key])) {
|
||||||
|
args[i][key] = new ObjectId(args[i][key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`Cannot parse argument at position ${i}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let result = global.Hydro.model[modelName][func](...args);
|
let result = global.Hydro.model[modelName][func](...args);
|
||||||
|
|||||||
Reference in new issue
Block a user