budibase/packages/cli/src/index.js

22 lines
598 B
JavaScript
Raw Normal View History

const { getCommands } = require("./options")
2021-02-24 18:32:45 +01:00
const { Command } = require("commander")
const { getHelpDescription } = require("./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)
program.helpOption()
// 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
}
init().catch(err => {
console.error(`Unexpected error - `, err)
})