2021-03-19 23:50:25 +13:00
|
|
|
#!/usr/bin/env node
|
2023-05-03 03:22:43 +12:00
|
|
|
process.env.DISABLE_PINO_LOGGER = "1"
|
2023-03-03 07:21:45 +13:00
|
|
|
import "./prebuilds"
|
|
|
|
import "./environment"
|
|
|
|
import { getCommands } from "./options"
|
|
|
|
import { Command } from "commander"
|
|
|
|
import { getHelpDescription } from "./utils"
|
2023-05-16 21:00:49 +12:00
|
|
|
import { version } from "../package.json"
|
2021-02-25 06:32:45 +13:00
|
|
|
|
2021-02-26 03:42:50 +13:00
|
|
|
// add hosting config
|
2021-02-27 00:46:48 +13:00
|
|
|
async function init() {
|
2021-02-26 03:42:50 +13:00
|
|
|
const program = new Command()
|
2021-02-27 00:46:48 +13:00
|
|
|
.addHelpCommand("help", getHelpDescription("Help with Budibase commands."))
|
|
|
|
.helpOption(false)
|
2023-05-16 21:00:49 +12:00
|
|
|
.version(version)
|
2021-02-27 00:46:48 +13:00
|
|
|
// add commands
|
|
|
|
for (let command of getCommands()) {
|
|
|
|
command.configure(program)
|
2021-02-26 03:42:50 +13:00
|
|
|
}
|
2021-02-27 00:46:48 +13:00
|
|
|
// this will stop the program if no command found
|
|
|
|
await program.parseAsync(process.argv)
|
2021-02-26 03:42:50 +13:00
|
|
|
}
|
2021-02-27 00:46:48 +13:00
|
|
|
|
2021-05-04 22:32:22 +12:00
|
|
|
init().catch(err => {
|
2021-02-27 00:46:48 +13:00
|
|
|
console.error(`Unexpected error - `, err)
|
|
|
|
})
|