bun runner
This commit is contained in:
parent
75fca493e5
commit
7635dfc124
|
|
@ -4,6 +4,7 @@
|
|||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"runner": "bun run src/runner.ts",
|
||||
"start": "bun src/server.tsx",
|
||||
"prod": "env NODE_ENV=production bun src/server.tsx",
|
||||
"dev": "env BUN_HOT=1 bun --hot src/server.tsx",
|
||||
|
|
|
|||
28
app/src/runner.ts
Normal file
28
app/src/runner.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
////
|
||||
// Runs a NOSE command in the NOSE environment
|
||||
// Ex:
|
||||
// $ bun runner greet Bob
|
||||
// Hi, Bob!
|
||||
|
||||
import { runCommand } from "./shell"
|
||||
|
||||
const args = Bun.argv.slice(2)
|
||||
|
||||
if (!args.length) {
|
||||
console.error("usage: runner <command> [args]")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const sessionId = ""
|
||||
const taskId = ""
|
||||
|
||||
const result = await runCommand(sessionId, taskId, args.join(" "))
|
||||
|
||||
if (result.status === "ok")
|
||||
console.log(result.output)
|
||||
|
||||
else if (result.status === "error")
|
||||
console.error(result.output)
|
||||
|
||||
else
|
||||
console.error("Unknown command result:", result)
|
||||
Loading…
Reference in New Issue
Block a user