mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 14:22:27 +00:00
19 lines
527 B
TypeScript
19 lines
527 B
TypeScript
import { Server } from "../../server/server"
|
|
import type { CommandModule } from "yargs"
|
|
|
|
export const GenerateCommand = {
|
|
command: "generate",
|
|
handler: async () => {
|
|
const specs = await Server.openapi()
|
|
const json = JSON.stringify(specs, null, 2)
|
|
|
|
// Wait for stdout to finish writing before process.exit() is called
|
|
await new Promise<void>((resolve, reject) => {
|
|
process.stdout.write(json, (err) => {
|
|
if (err) reject(err)
|
|
else resolve()
|
|
})
|
|
})
|
|
},
|
|
} satisfies CommandModule
|