refactor: several improvements (#132)

- js export expression
- check args regarding run-agent/run-tool
This commit is contained in:
sigoden
2024-11-30 17:14:21 +08:00
committed by GitHub
parent c4ba6ff379
commit d2a537c374
11 changed files with 52 additions and 24 deletions
+6 -1
View File
@@ -28,10 +28,15 @@ function parseArgv(thisFileName) {
toolData = process.argv[2];
}
if (toolName.endsWith(".js")) {
if (toolName && toolName.endsWith(".js")) {
toolName = toolName.slice(0, -3);
}
if (!toolData || !toolName) {
console.log(`Usage: ./run-tools.js <tool-name> <tool-data>`);
process.exit(1);
}
return [toolName, toolData];
}