budibase/packages/cli/src/index.ts

27 lines
728 B
TypeScript
Raw Normal View History

2021-03-19 11:50:25 +01:00
#!/usr/bin/env node
import "./prebuilds"
import "./environment"
import { env, logging } from "@budibase/backend-core"
logging.disableLogger()
import { getCommands } from "./options"
import { Command } from "commander"
import { getHelpDescription } from "./utils"
2021-02-24 18:32:45 +01:00
2021-02-25 15:42:50 +01:00
// add hosting config
async function init() {
2021-02-25 15:42:50 +01:00
const program = new Command()
.addHelpCommand("help", getHelpDescription("Help with Budibase commands."))
.helpOption(false)
2023-04-17 14:53:00 +02:00
.version(env.VERSION)
// add commands
for (let command of getCommands()) {
command.configure(program)
2021-02-25 15:42:50 +01:00
}
// this will stop the program if no command found
await program.parseAsync(process.argv)
2021-02-25 15:42:50 +01:00
}
2021-05-04 12:32:22 +02:00
init().catch(err => {
console.error(`Unexpected error - `, err)
})